rspec / rspec-mocks

RSpec's 'test double' framework, with support for stubbing and mocking
https://rspec.info
MIT License
1.16k stars 357 forks source link

Fix and_wrap_original failing with ruby 3.2 #1572

Closed Geesu closed 3 months ago

Geesu commented 3 months ago

This spec only fails in ruby 3.2, it succeeds with ruby 3.1. The failure in 3.2:

     ArgumentError:
       wrong number of arguments (given 1, expected 0; required keyword: my_object)
     Shared Example Group: "using and_wrap_original" called from ./spec/rspec/mocks/and_wrap_original_spec.rb:121
     # ./spec/rspec/mocks/and_wrap_original_spec.rb:27:in `initialize'
Geesu commented 3 months ago

Closing as my spec was incorrect, it should have been:

allow(MyService).to receive(:call_now).and_wrap_original do |blk, **args|