John Firebaugh
2010-Aug-09 20:35 UTC
Exceptions in functional tests (rescue_action_in_public! broken?)
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. http://github.com/rails/rails/commit/d898a4ba425a201827f07a5bb11c8c6bf85159b8 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. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.