diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/ruby/library/openstruct/method_missing_spec.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/ruby/library/openstruct/method_missing_spec.rb b/spec/ruby/library/openstruct/method_missing_spec.rb index eefe30661a..fe955791af 100644 --- a/spec/ruby/library/openstruct/method_missing_spec.rb +++ b/spec/ruby/library/openstruct/method_missing_spec.rb @@ -32,10 +32,17 @@ describe "OpenStruct#method_missing when called with a method name ending in '=' end describe "OpenStruct#method_missing when passed additional arguments" do - it "raises a NoMethodError" do + it "raises a NoMethodError when the key does not exist" do os = OpenStruct.new lambda { os.method_missing(:test, 1, 2, 3) }.should raise_error(NoMethodError) end + + ruby_version_is "2.7" do + it "raises an ArgumentError when the key exists" do + os = OpenStruct.new(test: 20) + lambda { os.method_missing(:test, 1, 2, 3) }.should raise_error(ArgumentError) + end + end end describe "OpenStruct#method_missing when not passed any additional arguments" do |