From 5754a29a974d31cab2b4392716b9825a3d910a69 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Thu, 31 Jan 2019 10:06:39 +0900 Subject: Fix `ERB.new` argument deprecated warning This fixes following warning. ``` warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments. ``` --- railties/test/generators/generators_test_helper.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'railties') diff --git a/railties/test/generators/generators_test_helper.rb b/railties/test/generators/generators_test_helper.rb index 975a204af4..8b42cb83db 100644 --- a/railties/test/generators/generators_test_helper.rb +++ b/railties/test/generators/generators_test_helper.rb @@ -79,7 +79,11 @@ module GeneratorsTestHelper end def evaluate_template(file, locals = {}) - erb = ERB.new(File.read(file), nil, "-", "@output_buffer") + erb = if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+ + ERB.new(File.read(file), trim_mode: "-", eoutvar: "@output_buffer") + else + ERB.new(File.read(file), nil, "-", "@output_buffer") + end context = Class.new do locals.each do |local, value| class_attribute local, default: value -- cgit v1.2.3