From 1f870a2c5911b2eec519062486a74a725e924b3d Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sat, 28 Jul 2012 20:40:27 -0700 Subject: [PATCH] issue a warning when we cannot construct a controller --- actionpack/lib/action_controller/test_case.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index eb7194ebaf..4ccb77992e 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -529,11 +529,19 @@ module ActionController @response = TestResponse.new @response.request = @request + @controller = nil unless defined? @controller + if klass = self.class.controller_class - @controller ||= klass.new rescue nil + unless @controller + begin + @controller = klass.new + rescue + warn "could not construct controller #{klass}" if $VERBOSE + end + end end - if defined?(@controller) && @controller + if @controller @controller.request = @request @controller.params = {} end