Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/shoulda/context/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ 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
Expand Down
12 changes: 12 additions & 0 deletions test/shoulda/should_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,18 @@ def test_should_raise_on_duplicate_naming
end
end

def self.this_is_missing(foo, k: 1)
end

def test_should_pass_on_missing_method
context = Shoulda::Context::Context.new("context name", self.class) do; end

assert_nothing_raised do
h = { k: 42 }
context.this_is_missing(h)
end
end
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added this test, but even if we remove the ruby2_keywords fix, this tests passes. I'm open to suggestion on how to improve it.


# Should statements

def test_should_have_should_hashes_when_given_should_statements
Expand Down