diff --git a/lib/shoulda/context/context.rb b/lib/shoulda/context/context.rb index c15b2ffc..a40b3025 100644 --- a/lib/shoulda/context/context.rb +++ b/lib/shoulda/context/context.rb @@ -208,6 +208,7 @@ def test_name_prefix def method_missing(method, *args, &blk) test_unit_class.send(method, *args, &blk) end + ruby2_keywords :method_missing if respond_to?(:ruby2_keywords, true) end class DuplicateTestError < RuntimeError; end diff --git a/test/shoulda/should_test.rb b/test/shoulda/should_test.rb index e9e95989..f5970e9e 100644 --- a/test/shoulda/should_test.rb +++ b/test/shoulda/should_test.rb @@ -192,6 +192,17 @@ def test_should_raise_on_duplicate_naming end end + def self.this_is_missing(foo, bar: 1) end + + def test_should_pass_on_missing_method + context = Shoulda::Context::Context.new("context name", self.class) {} + + assert_nothing_raised do + h = { bar: 42 } + context.this_is_missing(h) + end + end + # Should statements def test_should_have_should_hashes_when_given_should_statements