Hello.
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? I am using
RSpec 2.
does not work:
MyModel.should_receive(:offset).with(0).stub_chain(:tag_counts, :offset,
:limit, :order).and_return([])
also does succeed (expectation is never called):
MyModel.stub_chain(:tag_counts, :offset, :limit, :where, :order).and_return([])
MyModel.should_receive(:offset).with(0) { MyModel }
does succeed, but is IMHO quite unhandy (you can't stub_chain in a
before filter):
MyModel.stub(:tag_counts) { MyModel }
MyModel.should_receive(:offset).with(0) { MyModel }
MyModel.stub_chain(:limit, :where, :order).and_return([])
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users