I have this in my test
Project.should_receive(:find).with(@project).and_return(@project)
but when object receive that method call two times, I have to do
Project.should_receive(:find).with(@project).and_return(@project)
Project.should_receive(:find).with(@project).and_return(@project)
Is there any way how to say something like
Project.should_receive(:find).with(@project).and_return(@project).times(2)
for 2 times:
Project.should_receive(:find).twice.with(@project).and_return(@project)
for exactly n times:
Project.should_receive(:find).exactly(n).times.with(@project).and_return(@project)
for at least n times:
Project.should_receive(:msg).at_least(n).times.with(@project).and_return(@project)
more details at https://rspec.info/documentation/3.5/rspec-mocks/RSpec/Mocks/MessageExpectation.html under Constraining Receive Counts