Displaying 1 result from an estimated 1 matches for "foos_path".
Did you mean:
foo_path
2008 Mar 19
2
rescue
Hi, whats the correct way to spec a rescue? This will raise it but
doesnt test my code''s response
# controller
def edit
@foo = Foo.find(params[:id])
rescue
flash[:notice] = "Unknown foo #{params[:id]}"
redirect_to foos_path
end
# spec
it "should flash error if not found" do
Foo.should_receive(:find).and_raise
get :edit, :id => ''1''
flash[:notice].should == "Unknown foo 1"
end
# run
Exception in...
-------------- next part --------------
An HTML att...