diff options
Diffstat (limited to 'spec/ruby/library/erb')
-rw-r--r-- | spec/ruby/library/erb/new_spec.rb | 16 | ||||
-rw-r--r-- | spec/ruby/library/erb/run_spec.rb | 2 |
2 files changed, 17 insertions, 1 deletions
diff --git a/spec/ruby/library/erb/new_spec.rb b/spec/ruby/library/erb/new_spec.rb index f18e25939e..a5aeeaeed1 100644 --- a/spec/ruby/library/erb/new_spec.rb +++ b/spec/ruby/library/erb/new_spec.rb @@ -138,4 +138,20 @@ END ERB.new(@eruby_str).result ->{ ERB.new("<%= list %>").result }.should raise_error(NameError) end + + describe "warning about arguments" do + version_is ERB.version, "2.2.1" do #ruby_version_is "3.1" do + it "warns when passed safe_level and later arguments" do + -> { + ERB.new(@eruby_str, nil, '%') + }.should complain(/warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments./) + end + + it "does not warn when passed arguments as keyword argument" do + -> { + ERB.new(@eruby_str, trim_mode: '%') + }.should_not complain(/warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments./) + end + end + end end diff --git a/spec/ruby/library/erb/run_spec.rb b/spec/ruby/library/erb/run_spec.rb index 8c07442d8f..602e53ab38 100644 --- a/spec/ruby/library/erb/run_spec.rb +++ b/spec/ruby/library/erb/run_spec.rb @@ -6,7 +6,7 @@ describe "ERB#run" do # lambda { ... }.should output def _steal_stdout orig = $stdout - s = '' + s = +'' def s.write(arg); self << arg.to_s; end $stdout = s begin |