This project is archived and is in readonly mode.
rescue_from handlers are not being honored in functional tests
-
Matt Swasey
- Tag changed from 2.1, actionpack, bug, controller, patch, tests to actionpack, bug, controller, edge, patch, tests
+1
Ah ha! I just had this happen, thanks for the patch!
-
Pratik
- State changed from new to invalid
- Tag changed from actionpack, bug, controller, edge, patch, tests to 2.1, actionpack, bug, controller, edge, patch, tests
if you remove overridden 'rescue_action' in your functional test, it should work as expected.
-
Mark Cornick
# Re-raise errors caught by the controller. class ThingsController; def rescue_action(e) raise e end; endThe test posted above, as well as the tests in my current application that exposed this bug, do not contain these lines, and do not override rescue_action.
In other words, this is not the same issue as #664 rescue_from changes causing issues.
-
Mark Cornick
Lighthouse ate the text before my code block, which read:
"I assume you are referring to lines such as the following, which are present in tests generated by very old versions of the scaffold generator:"
-
Pratik
Oops. My bad. Could you please attach a failing test case or steps to reproduce ?
Thanks.
-
Mark Cornick
The attachment has a controller, functional test, and enough Rails infrastructure to demonstrate the bug.
Steps to reproduce: 1) unzip the code 2) install rails 2.1.0 gem or freeze rails 2.1.0 into vendor 3) rake test:functionals
Expected: test_show_with_invalid_id_should_set_flash should pass Actual: test_show_with_invalid_id_should_set_flash passes
4) git clone current edge rails into vendor 5) rake test:functionals
Expected: test_show_with_invalid_id_should_set_flash should pass Actual: test_show_with_invalid_id_should_set_flash raises an unhandled ActiveRecord::RecordNotFound exception and aborts
-
Pratik
- State changed from invalid to incomplete
- Assigned user set to Pratik
-
Pratik
- State changed from incomplete to open
- Milestone cleared.
- Tag changed from 2.1, actionpack, bug, controller, edge, patch, tests to 2.1, actionpack, bug, controller, edge, patch, tests
ActionController::TestCase is overriding rescue_action, causing this issue.
-
Repository
- State changed from open to resolved
(from [5e3517ea7b9fbd460f772bffc9212d882011f2bc]) Ensure rescue_from handlers are respected inside tests. [#835 rescue_from handlers are not being honored in functional tests state:resolved]
Note : If you're not using rescue_from, you should overrider rescue_action_without_handler() method and not rescue_action(). Afterwards, you can set request.remote_addr to a non "0.0.0.0" value for testing the overridden behavior. http://github.com/rails/rails/co...
