diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2019-01-31 10:06:39 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2019-01-31 10:08:24 +0900 |
commit | 5754a29a974d31cab2b4392716b9825a3d910a69 (patch) | |
tree | de1f53896bd54d369011b20f6b8fe6692d691c89 /railties | |
parent | 0a9bb48f83e287e8a9ca5c74eec4e7f926de5a46 (diff) | |
download | rails-5754a29a974d31cab2b4392716b9825a3d910a69.tar.gz rails-5754a29a974d31cab2b4392716b9825a3d910a69.tar.bz2 rails-5754a29a974d31cab2b4392716b9825a3d910a69.zip |
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.
```
Diffstat (limited to 'railties')
-rw-r--r-- | railties/test/generators/generators_test_helper.rb | 6 |
1 files changed, 5 insertions, 1 deletions
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 |