I have read (and experienced by testing) that if, in a controller, you do a
AR#find on a record id that does not exist, it throws an AR::RecordNotFound
error which is trapped by the default error handling in controllers and results
in a 404 status being returned by the controller. This happens with no special
code added by the user.
I have a test to verify this behavior, and it’s not working.
it “fails on an invalid record ID” do
get :show, id: -1
response.should_not be_success
end
This test produces:
Failure/Error: get 'show', id: -1
ActiveRecord::RecordNotFound:
Couldn't find Group with id=-1
What am I missing?
--
You received this message because you are subscribed to the Google Groups
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rspec/64427845-F83A-42EE-990A-1A055E746B3A%40pobox.com.