From 9c12841187fe02b9ac46bfc7667506f16d8bda1d Mon Sep 17 00:00:00 2001 From: Alan Harper Date: Mon, 19 Apr 2010 12:48:35 +1000 Subject: [PATCH] Missing method error doesn't specify which controller it is missing from The error page shown when the method you are requesting on a controller doesn't specify which controller the method is missing from --- actionpack/lib/abstract_controller/base.rb | 2 +- actionpack/test/controller/base_test.rb | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/actionpack/lib/abstract_controller/base.rb b/actionpack/lib/abstract_controller/base.rb index c12b584..96d7c85 100644 --- a/actionpack/lib/abstract_controller/base.rb +++ b/actionpack/lib/abstract_controller/base.rb @@ -115,7 +115,7 @@ module AbstractController @_action_name = action_name = action.to_s unless action_name = method_for_action(action_name) - raise ActionNotFound, "The action '#{action}' could not be found" + raise ActionNotFound, "The action '#{action}' could not be found for #{self.class.name}" end @_response_body = nil diff --git a/actionpack/test/controller/base_test.rb b/actionpack/test/controller/base_test.rb index 49f7968..4f58b5d 100644 --- a/actionpack/test/controller/base_test.rb +++ b/actionpack/test/controller/base_test.rb @@ -90,6 +90,7 @@ class RecordIdentifierController < ActionController::Base end class ControllerClassTests < ActiveSupport::TestCase + def test_controller_path assert_equal 'empty', EmptyController.controller_path assert_equal EmptyController.controller_path, EmptyController.new.controller_path @@ -166,7 +167,15 @@ class PerformActionTest < ActionController::TestCase rescue_action_in_public! end - + + def test_process_should_be_precise + use_controller EmptyController + exception = assert_raise AbstractController::ActionNotFound do + get :non_existent + end + assert_equal exception.message, "The action 'non_existent' could not be found for EmptyController" + end + def test_get_on_priv_should_show_selector use_controller MethodMissingController get :shouldnt_be_called -- 1.6.5.1