#352 √ resolved
David Chelimsky

similar message is not recognized when message is stubbed first

Reported by David Chelimsky | March 30th, 2008 @ 07:56 PM | in 1.1.4

@mock.stub!(:something)
@mock.should_receive(:something).with("a","b","c")
lambda {
  @mock.something("a","d","c")
  violated
}.should raise_error(MockExpectationError, "Mock 'test mock' expected :something with (\"a\", \"b\", \"c\") but received it with (\"a\", \"d\", \"c\")")

fails with:

expected Spec::Mocks::MockExpectationError with "Mock 'test mock' expected :something with (\"a\", \"b\", \"c\") but received it with (\"a\", \"d\", \"c\")", got Spec::Expectations::ExpectationNotMetError

Other similar cases fail with something like this:

Mock 'test mock' expected :something with (\"a\", \"b\", \"c\") but it was never received.

If there is no stub of :something, the message is more helpful, like this:

Mock 'test mock' expected :something with (\"a\", \"b\", \"c\") but received it with (\"a\", \"d\", \"c\")

We should get that to work even when there is a stub.

Comments and changes to this ticket

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Behaviour Driven Development for Ruby.

Shared Ticket Bins

People watching this ticket

Tags