Friday, November 13, 2009

Testing - Problems - Rspec Controllers - RecordNotFound

If you are using Rspec to test a controller method that raise a RecordNotFound exception be aware of adding this:
controller.use_rails_error_handling!

in your controllers.

Here you can find an example:
http://pastie.org/151743
otherwise the exception will be thrown, and your test will fail :(.

"Over and out"

Update: I wrote this before running my test, so now I know that the previous solution is deprecated, you should use #rescue_action_in_public! now :)

No comments:

Post a Comment