Closed AlbertoTejada closed 2 years ago
Only the last counter matcher in a expectation is considerer, the rest are ignored.
Define an expectation with a counter range:
it 'receives message between 5 and 6 times ' do expect(receiver).to receive(:message).at_least(5).at_most(6).times method_call end
Expect the case to fail if message is received less than 5 times OR more than 6 times
message
The test case fails if message is received more than 6 times, but it passes when message is received less than 5 times
Thanks for reporting. This is a duplicate of #1426 if I'm not mistaken. There are several problems with counts if you check comments, and a suggestion how to improve that. Pull requests are welcome!
Allow multiple receive counts matchers for an expected message
Only the last counter matcher in a expectation is considerer, the rest are ignored.
Your environment
Steps to reproduce
Define an expectation with a counter range:
Expected behavior
Expect the case to fail if
message
is received less than 5 times OR more than 6 timesActual behavior
The test case fails if
message
is received more than 6 times, but it passes whenmessage
is received less than 5 times