class RuboCop::Cop::RSpec::ReceiveMessages

Checks for multiple messages stubbed on the same object.

@safety

The autocorrection is marked as unsafe, because it may change the
order of stubs. This in turn may cause e.g. variables to be called
before they are defined.

@example

# 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