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

Fix keyword arguments in dynamic method dispatch #2509

Closed
Closed
Show file tree
Hide file tree
Changes from 4 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/rspec/rails/example/controller_example_group.rb
Expand Up @@ -176,6 +176,7 @@ def method_missing(method, *args, &block)
super
end
end
ruby2_keywords :method_missing if respond_to?(:ruby2_keywords, true)

included do
subject { controller }
Expand Down
6 changes: 6 additions & 0 deletions spec/rspec/rails/example/controller_example_group_spec.rb
Expand Up @@ -19,6 +19,12 @@ def group_for(klass)
expect(group.included_modules).to include(RSpec::Rails::Matchers::RoutingMatchers)
end

it "handles methods invoked via `method_missing` that use keywords" do
example = group.new
example.define_singleton_method(:keyword_value) { |value:| value }
expect(example.keyword_value(value: 42)).to eq 42
pirj marked this conversation as resolved.
Show resolved Hide resolved
end

context "with implicit subject" do
it "uses the controller as the subject" do
controller = double('controller')
Expand Down