From 78129b1731a1e6f3b091e996bcf55917d84b5f0e Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 25 Aug 2009 23:34:48 -0500 Subject: Track all AC base subclasses as possible controllers for internal testing --- actionpack/test/new_base/test_helper.rb | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'actionpack/test/new_base') diff --git a/actionpack/test/new_base/test_helper.rb b/actionpack/test/new_base/test_helper.rb index 9271b2dd59..b7ccd3db8d 100644 --- a/actionpack/test/new_base/test_helper.rb +++ b/actionpack/test/new_base/test_helper.rb @@ -35,12 +35,6 @@ class Rack::TestCase < ActionController::IntegrationTest setup do ActionController::Base.session_options[:key] = "abc" ActionController::Base.session_options[:secret] = ("*" * 30) - - controllers = ActionController::Base.subclasses.map do |k| - k.underscore.sub(/_controller$/, '') - end - - ActionController::Routing.use_controllers!(controllers) end def app @@ -91,10 +85,26 @@ end class ::ApplicationController < ActionController::Base end +module ActionController + class << Routing + def possible_controllers + @@possible_controllers ||= [] + end + end + + class Base + def self.inherited(klass) + name = klass.name.underscore.sub(/_controller$/, '') + ActionController::Routing.possible_controllers << name unless name.blank? + super + end + end +end + class SimpleRouteCase < Rack::TestCase setup do ActionController::Routing::Routes.draw do |map| map.connect ':controller/:action/:id' end end -end \ No newline at end of file +end -- cgit v1.2.3