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

envygeeks opened this Issue Dec 29, 2015 · 1 comment


None yet
2 participants

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)*args, **kwd)

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 milestone Jun 14, 2017


This comment has been minimized.


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)*args, **kwd)

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

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