diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 84610c34c0ce1..084e0887b7991 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -3,9 +3,15 @@ module ActionController class NonInferrableControllerError < ActionControllerError def initialize(name) + @name = name super "Unable to determine the controller to test from #{name}. " + "You'll need to specify it using 'tests YourController' in your " + - "test case definition" + "test case definition. This could mean that #{inferred_controller_name} does not exist " + + "or it contains syntax errors" + end + + def inferred_controller_name + @name.sub(/Test$/, '') end end