Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib/context: fix Ruby 2.7 warning #64

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/shoulda/context/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions test/shoulda/should_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
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