controller
def whatever @foo = Foo.find params[:id] end |
spec
before(:each) do @foo = stub_model(Foo) Foo.stub!(:find).with(params[:id]).and_return(@foo) # i expect you set the params[:id] somewhere. # don't complain when it's nil. # you set it manually or whatever. end |
