[rspec-users] stub with assigns?
pergesu at gmail.com
Thu Dec 13 02:12:29 EST 2007
On Dec 12, 2007 11:00 PM, Jonathan Linowes <jonathan at parkerhill.com> wrote:
> is there a way to stub a method that sets an instance variable, so the stub
> sets it too?
> def find_foo
> @foo = Foo.find(params[:id]
> controller.stub!(:find_foo).and_assigns(:foo, "123")
huh? I think what you want to be doing is
and then assigns[:foo] will of course be set to @mock_foo.
More information about the rspec-users