Rails 3 は、rescue_from ハンドラーを無視しているように見えるため、以下のリダイレクトをテストできません。
class ApplicationController < ActionController::Base
rescue_from ActionController::RoutingError, :with => :rescue_404
def rescue_404
flash[:notice] = "Error 404. The url <i>'#{env["vidibus-routing_error.request_uri"]}'</i> does not exist on this website."
redirect_to root_path
end
end
機能テストと統合テストの両方で、この rescue_from は無視され、エラーが発生します。
ActionController::RoutingError: No route matches "/non_existent_url"
test/integration/custom_404_test.rb:5:in `test_404'
これがテストで適切に「キャッチ」されていることを確認するにはどうすればよいですか?