module RSpec::Rails::ControllerExampleGroup::ClassMethods

def controller(base_class = nil, &body)

Other tags:
    Note: - Due to Ruby 1.8 scoping rules in anoymous subclasses, constants
def controller(base_class = nil, &body)
  base_class ||= RSpec.configuration.infer_base_class_for_anonymous_controllers? ?
                   controller_class :
                   ApplicationController
  metadata[:example_group][:described_class] = Class.new(base_class) do
    def self.name; "AnonymousController"; end
  end
  metadata[:example_group][:described_class].class_eval(&body)
  before do
    @orig_routes, @routes = @routes, ActionDispatch::Routing::RouteSet.new
    @routes.draw { resources :anonymous }
  end
  after do
    @routes, @orig_routes = @orig_routes, nil
  end
end