Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display matching invocations alongside their respective expectations in error message #178

Closed
floehopper opened this issue Jan 5, 2014 · 1 comment

Comments

@floehopper
Copy link
Member

See #167. Display all the actual invocations recorded against both unsatisfied & satisfied expectations, including the parameter values passed into the method and the return value generated by the expectation. I'm thinking along the following lines:

foo = mock('foo')
foo.expects(:bar).with(1).returns('a')
foo.stubs(:bar).with(2).returns('b').then.returns('c').then.raises(StandardError)

3.times { foo.bar(2) }
foo.bar(3)
unexpected invocation: #<Mock:foo>.bar(3)
unsatisfied expectations:
- expected exactly once, not yet invoked: #<Mock:foo>.bar(1)
satisfied expectations:
- allowed any number of times, invoked 3 times: #<Mock:foo>.bar(2)
  - #<Mock:foo>.bar(2) # => 'b'
  - #<Mock:foo>.bar(2) # => 'c'
  - #<Mock:foo>.bar(2) # => raised StandardError

It would also be nice to record any yields that occur.

We might only want to enable this using a verbose configuration option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant