From e5e87041ceafc64d11a01e5a1c7ce1f978a788a6 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Tue, 17 Jan 2012 09:58:52 -0200 Subject: Deprecate AC::UnknownError and AC::DoubleRenderError Use the constants AbstractController::ActionNotFound and AbstractController::DoubleRenderError respectively instead. --- actionpack/lib/action_controller/metal/compatibility.rb | 4 ++-- actionpack/test/controller/base_test.rb | 4 ++-- actionpack/test/controller/render_test.rb | 10 +++++----- actionpack/test/dispatch/debug_exceptions_test.rb | 4 ++-- actionpack/test/dispatch/show_exceptions_test.rb | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/metal/compatibility.rb b/actionpack/lib/action_controller/metal/compatibility.rb index 21626fde44..9895b2b4b5 100644 --- a/actionpack/lib/action_controller/metal/compatibility.rb +++ b/actionpack/lib/action_controller/metal/compatibility.rb @@ -9,8 +9,8 @@ module ActionController # Temporary hax included do - ::ActionController::UnknownAction = ::AbstractController::ActionNotFound - ::ActionController::DoubleRenderError = ::AbstractController::DoubleRenderError + ::ActionController::UnknownAction = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('ActionController::UnknownAction', '::AbstractController::ActionNotFound') + ::ActionController::DoubleRenderError = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('ActionController::DoubleRenderError', '::AbstractController::DoubleRenderError') # ROUTES TODO: This should be handled by a middleware and route generation # should be able to handle SCRIPT_NAME diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb index b11fc02604..76e5786e70 100644 --- a/actionpack/test/controller/base_test.rb +++ b/actionpack/test/controller/base_test.rb @@ -189,8 +189,8 @@ class PerformActionTest < ActionController::TestCase def test_get_on_hidden_should_fail use_controller NonEmptyController - assert_raise(ActionController::UnknownAction) { get :hidden_action } - assert_raise(ActionController::UnknownAction) { get :another_hidden_action } + assert_raise(AbstractController::ActionNotFound) { get :hidden_action } + assert_raise(AbstractController::ActionNotFound) { get :another_hidden_action } end end diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index 0bac073154..28f6bc88e0 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -893,12 +893,12 @@ class RenderTest < ActionController::TestCase # :ported: def test_attempt_to_access_object_method - assert_raise(ActionController::UnknownAction, "No action responded to [clone]") { get :clone } + assert_raise(AbstractController::ActionNotFound, "No action responded to [clone]") { get :clone } end # :ported: def test_private_methods - assert_raise(ActionController::UnknownAction, "No action responded to [determine_layout]") { get :determine_layout } + assert_raise(AbstractController::ActionNotFound, "No action responded to [determine_layout]") { get :determine_layout } end # :ported: @@ -1098,15 +1098,15 @@ class RenderTest < ActionController::TestCase # :ported: def test_double_render - assert_raise(ActionController::DoubleRenderError) { get :double_render } + assert_raise(AbstractController::DoubleRenderError) { get :double_render } end def test_double_redirect - assert_raise(ActionController::DoubleRenderError) { get :double_redirect } + assert_raise(AbstractController::DoubleRenderError) { get :double_redirect } end def test_render_and_redirect - assert_raise(ActionController::DoubleRenderError) { get :render_and_redirect } + assert_raise(AbstractController::DoubleRenderError) { get :render_and_redirect } end # specify the one exception to double render rule - render_to_string followed by render diff --git a/actionpack/test/dispatch/debug_exceptions_test.rb b/actionpack/test/dispatch/debug_exceptions_test.rb index f3dc160d7d..c3a565990e 100644 --- a/actionpack/test/dispatch/debug_exceptions_test.rb +++ b/actionpack/test/dispatch/debug_exceptions_test.rb @@ -24,7 +24,7 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest when "/pass" [404, { "X-Cascade" => "pass" }, self] when "/not_found" - raise ActionController::UnknownAction + raise AbstractController::ActionNotFound when "/runtime_error" raise RuntimeError when "/method_not_allowed" @@ -83,7 +83,7 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest get "/not_found", {}, {'action_dispatch.show_exceptions' => true} assert_response 404 - assert_match(/#{ActionController::UnknownAction.name}/, body) + assert_match(/#{AbstractController::ActionNotFound.name}/, body) get "/method_not_allowed", {}, {'action_dispatch.show_exceptions' => true} assert_response 405 diff --git a/actionpack/test/dispatch/show_exceptions_test.rb b/actionpack/test/dispatch/show_exceptions_test.rb index e9504f3524..4a6d5ddbf7 100644 --- a/actionpack/test/dispatch/show_exceptions_test.rb +++ b/actionpack/test/dispatch/show_exceptions_test.rb @@ -7,7 +7,7 @@ class ShowExceptionsTest < ActionDispatch::IntegrationTest req = ActionDispatch::Request.new(env) case req.path when "/not_found" - raise ActionController::UnknownAction + raise AbstractController::ActionNotFound when "/method_not_allowed" raise ActionController::MethodNotAllowed when "/not_found_original_exception" -- cgit v1.2.3