On Jul 28, 2012, at 11:44 PM, Aaron Patterson wrote: > In the case a developer has not constructed a controller, the setup > method of ActionController::TestCase will attempt to construct a > controller object. If it cannot construct a controller object, it > silently fails. > > I added a warning in this case, and I'd like to eventually deprecate the > behavior. I can't think of why anyone would want to use > ActionController::TestCase and *not* test a controller. Does anyone > know a reason *why* we would do this? > > > https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/test_case.rb#L534-542
Maybe I'm missing something, but doesn't the call to setup_controller_request_and_response happen *before* any user-defined setup methods get called? In that case, it's intended to let users do unusual things (that don't set, or set to nonsense, controller_class) and then set up their own controller object. There are some related commits that seem relevant: https://github.com/rails/rails/commit/13950a8cc94ab93bb20976f2797b1df9740849b3 https://github.com/rails/rails/commit/ee82e1c3015392c87c88ee32003763210a75d1ec https://github.com/rails/rails/commit/529a3ee50eeb7db5a78afeb5da38fd71b42e7ea2 I'd say there's a good chance that all of these changes are intended to support doing things like this: https://www.relishapp.com/rspec/rspec-rails/docs/controller-specs/anonymous-controller by handling the case where the controller-under-test isn't a named constant. --Matt Jones -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.