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

Allow assertion that Array#reverse is not called #1533

Closed brtrick closed 1 year ago

brtrick commented 1 year ago

An expect_any_instance_of(Array).to_not receive(:reverse) will always fail because RSpec calls Array#reverse as part of its reset_all cleanup method, triggering the recorder before it is reset. This PR resolves the issue by clearing the recorders in reset_all before Array#reverse is called.

Fixes #1532

brtrick commented 1 year ago

Ok, I added a spec that tests for it, but I'm not sure that's the best way to handle the spec. Suggestions welcome.

JonRowe commented 1 year ago

Released in 3.12.4 thank you!