Skip to content

Fix Method#parameters for a method generated by respond_to_missing?#4561

Merged
enebo merged 1 commit intojruby:masterfrom
etehtsea:fix-method-params
Apr 18, 2017
Merged

Fix Method#parameters for a method generated by respond_to_missing?#4561
enebo merged 1 commit intojruby:masterfrom
etehtsea:fix-method-params

Conversation

@etehtsea
Copy link
Contributor

Not sure that this is the proper way to fix this issue, but it seems to work and fixes actual issue I've got using rspec-mocks.

require 'diplomat'

RSpec.configure do |c|
    c.mock_with :rspec do |mocks|
    mocks.verify_partial_doubles = true
  end
end

RSpec.describe 'jruby issue' do
  specify do
    allow(Diplomat::Kv).to receive(:get)
                             .with('key', recurse: true, decode_values: true)
                             .and_return('mocked')

    expect(Diplomat::Kv.get('key', recurse: true, decode_values: true)).to eq('mocked')
  end
end
Failures:

  1) jruby issue
     Failure/Error: allow(Diplomat::Kv).to receive(:get)
       Wrong number of arguments. Expected 0, got 2.
     # ./demo2.rb:11:in `block in (root)'

Finished in 0.02773 seconds (files took 0.55134 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./demo2.rb:10 # jruby issue

Relates to #2816

@enebo enebo added this to the JRuby 9.1.9.0 milestone Apr 18, 2017
@enebo enebo merged commit e70cf66 into jruby:master Apr 18, 2017
@etehtsea etehtsea deleted the fix-method-params branch April 18, 2017 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants