Pattern: Multiple messages stubbed on the same object
Issue: -
Checks for multiple messages stubbed on the same object.
# bad
before do
allow(Service).to receive(:foo).and_return(bar)
allow(Service).to receive(:baz).and_return(qux)
end
# good
before do
allow(Service).to receive_messages(foo: bar, baz: qux)
end
# good - ignore same message
before do
allow(Service).to receive(:foo).and_return(bar)
allow(Service).to receive(:foo).and_return(qux)
end