[rspec-users] Expecting arbitrary method calls in a particular order

Sven Fuchs svenfuchs at artweb-design.de
Sun Jul 13 12:03:07 EDT 2008

Hey Ashley!

How's things? :)

On 13.07.2008, at 17:44, Ashley Moran wrote:
> I think you want
>  second.should_receive(:run) do
>    first.should_receive(:run)
>  end
> which, if Mail.app is running my specs correctly, should only pass  
> if second receives :run before first
> Is that what you were after?

Wow, yes.

This also uses the block passed to should_receive, but in a nicer way  
than my inital attemp which is a bit chatty.

It'd look a bit odd when I want to specify the order for a bunch of  
methods, but actually I don't need to do that here.

Again, this really should be documented. I even started digging into  
the RSpec source, but obviously lacked the creativity for this :)

sven fuchs			svenfuchs at artweb-design.de
artweb design		http://www.artweb-design.de
grünberger 65		+ 49 (0) 30 - 47 98 69 96 (phone)
d-10245 berlin		+ 49 (0) 171 - 35 20 38 4 (mobile)

More information about the rspec-users mailing list