Exceptions in functional tests (rescue_action_in_public! broken?)

62 views
Skip to first unread message

John Firebaugh

unread,
Aug 9, 2010, 4:35:30 PM8/9/10
to rubyonra...@googlegroups.com
In 2.3, exceptions raised by controllers under functional tests were by default propagated to the test, but by using rescue_action_in_public! a test could trigger the production, public behavior and then use assert_response or similar to test the expected result. This was implemented via coordination between ActionController::Rescue and ActionController::TestCase::RaiseActionExceptions.

This coordination is no longer present in 3.0.0.rc1; rescue_action_in_public! has no effect on whether or not exceptions propagate to the test (they always do).

The mis-coordination has two aspects:

a) config.action_dispatch.show_exceptions now defaults to false, meaning the ShowExceptions middleware is not used at all in the test environment -- i.e. there's no way exceptions could be caught.


b) ActionController::TestCase::RaiseActionExceptions#rescue_action_without_handler never gets called, because it's not overriding anything anymore -- i.e. there's no way exceptions could be reraised in the rescue_action_in_public! case.

What's the deal here? I prefer to be able to use assert_response consistently in functional tests, rather than having to mix assert_response and assert_raise, so I'd call it a bug.
Reply all
Reply to author
Forward
0 new messages