diff options
Diffstat (limited to 'spec/ruby/language/method_spec.rb')
-rw-r--r-- | spec/ruby/language/method_spec.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/ruby/language/method_spec.rb b/spec/ruby/language/method_spec.rb index 462a182b3d..449d5e6f1b 100644 --- a/spec/ruby/language/method_spec.rb +++ b/spec/ruby/language/method_spec.rb @@ -1758,6 +1758,17 @@ describe "A method" do end end end + + it "assigns the last Hash to the last optional argument if the Hash contains non-Symbol keys and is not passed as keywords" do + def m(a = nil, b = {}, v: false) + [a, b, v] + end + + h = { "key" => "value" } + m(:a, h).should == [:a, h, false] + m(:a, h, v: true).should == [:a, h, true] + m(v: true).should == [nil, {}, true] + end end describe "A method call with a space between method name and parentheses" do |