Just curious. How is the @controller instance variable inside the controller specs being instantiated? And where?
1 Answer
I believe this is actually being done by ActionController::TestCase::Behavior#setup_controller_request_and_response, which is wired up by RSpec::Rails::SetupAndTeardownAdapter#setup, which is included by RSpec::Rails::RailsExampleGroup and used by RSpec::Rails::ControllerExampleGroup. :)
bundle open rspec-rails is an easy way to start looking at how this stuff works.
HTH!