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

**kwd, call(**kwd) does not behave like MRI. #3572

Closed
envygeeks opened this issue Dec 29, 2015 · 1 comment
Closed

**kwd, call(**kwd) does not behave like MRI. #3572

envygeeks opened this issue Dec 29, 2015 · 1 comment
Milestone

Comments

@envygeeks
Copy link

@envygeeks envygeeks commented Dec 29, 2015

The following was discovered through RSpec Mocks and I'm cross posting it just in-case. Given the following code:

allow(described_class).to receive(:new).and_wrap_original do |method, *args, **kwd|
  kwd[:root] = true unless kwd.key?(:root) || kwd.key?(:root_metadata)
  method.call(*args, **kwd)
end

The method being wrapped never receives the kwd, this was discovered when our specs started failing on JRuby when we started defaulting to reduce duplication in our specs, which ultimately was dumb anyways but it still surfaced an inconsistency.

RSpec Mocks Ticket: rspec/rspec-mocks#1045

@enebo enebo added this to the JRuby 9.2.0.0 milestone Jun 14, 2017
@enebo
Copy link
Member

@enebo enebo commented Jun 14, 2017

This was no doubt fixed a very long time ago but I used this snippet to verify:

define_method(:foo) do |method, *args, **kwd|
  kwd[:root] = true unless kwd.key?(:root) || kwd.key?(:root_metadata)
  method.call(*args, **kwd)
end

foo(proc do |*b, **k|
  p b, k
end)

I would be incredibly surprised if we do not already have a test/spec on this between the testing suites so closing. I will close against next release so people can notice this was fixed in release notes.

@enebo enebo closed this Jun 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.