Created
January 30, 2012 14:47
-
-
Save lukeredpath/1704783 to your computer and use it in GitHub Desktop.
Rspec mock sequences?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# preferred format: | |
in_sequence(:task_order) do | |
task_one.should_receive(:execute) | |
task_two.should_receive(:execute) | |
end | |
# or even: | |
sequence = sequence(:task_order) | |
task_one.should_receive(:execute).in_sequence(sequence) | |
task_two.should_receive(:execute).in_sequence(sequence) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just tried it with both rspec and mocha and both do a less than desirable job. rspec doesn't enforce order across objects (so only mocha satisfies @lukeredpath's issue right now), but it's messaging is clear when order is violated within one object:
Mocha does enforce order across objects, but its messaging is unclear. Here's the result of the example with the last two lines reversed, e.g.
Looks like we both have some work to do :)
rspec/rspec-mocks#101
https://github.com/floehopper/mocha/issues/60