[rspec-users] Example controller spec no worky?

Brad Carson lists at ruby-forum.com
Wed Feb 13 15:53:08 EST 2008


> I was led to believe Rails automatically handled RecordNotFounds with a 
> 404, meaning I didn't have to catch them myself.
> 
> I made sure requests weren't considered local in the test environment to 
> trigger the 404 page instead of the debug info.  I tried putting a 
> rescue_action_in_public in the application controller to handle the 
> RecordNotFound and do the 404 render, just in case, but the spec won't 
> pass unless I rescue the exception inside the show method, which doesn't 
> seem right or necessary.

Aha!  Had to use: controller.use_rails_error_handling!

Here's the complete spec:
http://pastie.caboo.se/151743

As per the pasite, requests have to be non-local.

Thank you to everyone who pitched in to help!
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list