search for: methodstub

Displaying 1 result from an estimated 1 matches for "methodstub".

2007 Oct 08
6
stub actions that depend on the parameter
Hi, I''m pretty new to all related to bdd and rspec and I have the following question. Is it possible to stub actions that return different objects depending on the parameteres they were called with? Something like this: MyClass.stub!(:method).with(1).and_return(@mock_object_1) MyClass.stub!(:method).with(2).and_return(@mock_object_2) I know I could use