[rspec-users] issue with rescue_action_in_public! and testing 404 responses
John Firebaugh
john.firebaugh at gmail.com
Tue Aug 10 16:52:16 EDT 2010
On Aug 9, 7:21 pm, David Chelimsky <dchelim... at gmail.com> wrote:
> It's up to you to handle the error in the controller. Something like this in ApplicationController:
>
> rescue_from ActiveRecord::RecordNotFound do
> render '/404.html', :layout => false, :status => :not_found
> end
Actually, I believe this is a bug in Rails 3.
ActiveRecord::RecordNotFound should be handled automatically by the
ActionDispatch::ShowExceptions middleware, and then
rescue_action_in_public! in your controller test should continue to
work as it did in Rails 2, allowing you to verify the result is a 404.
I posted to rails-core about this issue:
http://groups.google.com/group/rubyonrails-core/browse_thread/thread/e7379309d2308f28
More information about the rspec-users
mailing list