[rspec-users] Expecting arbitrary method calls in a particular order
dchelimsky at gmail.com
Sun Jul 13 10:41:53 EDT 2008
On Sun, Jul 13, 2008 at 9:32 AM, Pat Maddox <pergesu at gmail.com> wrote:
> On Sun, Jul 13, 2008 at 9:49 AM, Sven Fuchs <svenfuchs at artweb-design.de> wrote:
>> I've been wondering how to expect arbitrary methods being called in a
>> particular order. The RSpec documentation for expecting method calls on mock
>> objects mentions that it is possible to pass a block to #should_receive, but
>> does not mention that it can be used to track the method call order pretty
>> Is there a better way of doing this?
>> If not, do you think it would make sense to add this to the RSpec docs?
> Hey Sven,
> Mock objects have an optional notion of ordering. Check out the following spec:
> describe "a mock object" do
> it "should expect ordered messages" do
> foo = mock("ordered mock")
> Changing the order in which they're called will raise an ExpectationNotMetError.
Sven, FYI - this is explained on the page you mentioned:
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users