[rspec-users] stub_chain together with should_receive

medihack kai.schlamp at googlemail.com
Tue Nov 23 20:12:46 EST 2010


I am trying to test if in a method calling chain one of the methods
get a specific parameter. In the below code for example MyModel must
receive the parameter 0 for the method "offset". Unfortunately the
code below does not work. It seems it is not possible to mix
should_receive and stub_chain. How could I solve this?

MyModel.should_receive(:offset).with(0).stub_chain(:tag_counts, :offset, :limit, :order).and_return([])
# does not work!


More information about the rspec-users mailing list