diff --git a/actionpack/lib/action_controller/dispatch/middlewares.rb b/actionpack/lib/action_controller/dispatch/middlewares.rb index b25ed3f..df8f4af 100644 --- a/actionpack/lib/action_controller/dispatch/middlewares.rb +++ b/actionpack/lib/action_controller/dispatch/middlewares.rb @@ -6,7 +6,6 @@ use "ActionDispatch::ShowExceptions", lambda { ActionController::Base.consider_a use "ActionDispatch::Callbacks", lambda { ActionController::Dispatcher.prepare_each_request } use "ActionDispatch::Rescue", lambda { controller = (::ApplicationController rescue ActionController::Base) - # TODO: Replace with controller.action(:_rescue_action) controller.method(:rescue_action) } @@ -15,4 +14,4 @@ use lambda { ActionController::Base.session_store }, use "ActionDispatch::ParamsParser" use "Rack::MethodOverride" -use "Rack::Head" \ No newline at end of file +use "Rack::Head" diff --git a/actionpack/test/controller/rescue_test.rb b/actionpack/test/controller/rescue_test.rb index 2340871..a6326e7 100644 --- a/actionpack/test/controller/rescue_test.rb +++ b/actionpack/test/controller/rescue_test.rb @@ -228,9 +228,17 @@ class ControllerInheritanceRescueControllerTest < ActionController::TestCase end class ApplicationController < ActionController::Base + cattr_accessor :before_filter_called + before_filter :log_before_filter_called + rescue_from ActionController::RoutingError do render :text => 'no way' end + + protected + def log_before_filter_called + @@before_filter_called += 1 + end end class RescueControllerTest < ActionController::TestCase @@ -291,7 +299,7 @@ class RescueControllerTest < ActionController::TestCase end class RescueTest < ActionController::IntegrationTest - class TestController < ActionController::Base + class TestController < ApplicationController class RecordInvalid < StandardError def message 'invalid' @@ -317,6 +325,14 @@ class RescueTest < ActionController::IntegrationTest end end + def setup + ApplicationController.before_filter_called = 0 + end + + def teardown + assert_equal 1, ApplicationController.before_filter_called + end + test 'normal request' do with_test_routing do get '/foo'