Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

rescue_action_in_public! no longer works

#5444

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...

Reported by John Firebaugh · August 24th, 2010 @ 04:11 PM

State: new
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Ryan McGeary
    Ryan McGeary

    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.

    October 18th, 2010 @ 12:00 AM

  2. Jason Morrison
    Jason Morrison

    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!

    December 2nd, 2010 @ 12:39 AM

  3. bingbing