This project is archived and is in readonly mode.
rescue_action_in_public! no longer works
Reported by John Firebaugh | August 24th, 2010 @ 04:11 PM
Since the middleware stack is not present in controller tests, the ShowExceptions middleware cannot translate exceptions such as ActiveRecord::RecordNotFound into 404s, and rescue_action_in_public! basically does nothing. You can't use assert_response to check the result, you have to use assert_raise sometimes and assert_response others.
To quote Jeremy Kemper: "assert_raise in some cases and assert_response in others - yuk." [http://dev.rubyonrails.org/ticket/2922#comment:4]
This issue was raised on rails-core here: http://groups.google.com/group/rubyonrails-core/browse_thread/threa...
And with rspec 2 here: http://github.com/rspec/rspec-rails/issues/#issue/181
And here:
http://groups.google.com/group/rspec/browse_thread/thread/8c2cdf5ef...
Comments and changes to this ticket
-
Ryan McGeary October 18th, 2010 @ 12:00 AM
Is
rescue_action_in_public!
intended to be deprecated?I'm willing to spend some time looking into a fix for this, but I'd like to know the direction that Rails 3 is hoping to achieve. I'm not sure I understand why the ShowExceptions middleware is not used in the test environment. This seems like it would cause more long-term harm than good.
It's a real bummer that we can't test custom rescue responses anymore.
-
Jason Morrison December 2nd, 2010 @ 12:39 AM
Agreed, I'd like to know the direction here. We use this in function tests in an app we're upgrading to Rails3 and wonder what the intended direction here is.
Thanks!
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>