[have_receive] (not have_receive"d") will return true no matter what
Created by: github0013
Subject of the issue
Calling have_receive
always become true. (not have_receive[d]
)
have_receive
, does this matcher method exist?
https://relishapp.com/rspec/rspec-mocks/docs/basics/spies
I only see have_receive[d]
Your environment
- ruby 2.6.2p47 (2019-03-13 revision 67232) [x86_64-darwin16]
- rspec-mocks (3.8.1)
Steps to reproduce
describe :have_receive do
let(:object) { spy(:object) }
it do
object.some_method
# This is expected to be true
expect(object).to have_received(:some_method)
end
# This is expected to be false, but is true, and it doesn't even raise an error for `have_receive`
it { expect(object).to have_receive(:method_never_called) }
end
Expected behavior
# This should not pass or should raise an error for the method missing?
it { expect(object).to have_receive(:never_exist_method) }
Actual behavior
# This passes, when it shouldn't
it { expect(object).to have_receive(:never_exist_method) }