aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorNicholas Seckar <nseckar@gmail.com>2006-09-23 17:25:06 +0000
committerNicholas Seckar <nseckar@gmail.com>2006-09-23 17:25:06 +0000
commit8d809e724ac3e5ebc7f35e40f95632c853c68d89 (patch)
tree6ddf7eca253fc68cffeb943151f70e4508b03895 /actionpack/test/controller
parent704443dcf2b61cedfa91d4352bbb351e17997b7c (diff)
downloadrails-8d809e724ac3e5ebc7f35e40f95632c853c68d89.tar.gz
rails-8d809e724ac3e5ebc7f35e40f95632c853c68d89.tar.bz2
rails-8d809e724ac3e5ebc7f35e40f95632c853c68d89.zip
Clear the cache of possible controllers whenever Routes are reloaded.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5169 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/routing_test.rb28
1 files changed, 27 insertions, 1 deletions
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index ee2ef63377..1dc61df5fb 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -18,8 +18,8 @@ class LegacyRouteSetTests < Test::Unit::TestCase
attr_reader :rs
def setup
@rs = ::ActionController::Routing::RouteSet.new
- ActionController::Routing.use_controllers! %w(content admin/user admin/news_feed)
@rs.draw {|m| m.connect ':controller/:action/:id' }
+ ActionController::Routing.use_controllers! %w(content admin/user admin/news_feed)
end
def test_default_setup
@@ -1657,9 +1657,35 @@ class RoutingTest < Test::Unit::TestCase
if true_controller_paths
ActionController::Routing.controller_paths = true_controller_paths
end
+ ActionController::Routing.use_controllers! nil
Object.send(:remove_const, :RAILS_ROOT) rescue nil
end
+ def test_possible_controllers_are_reset_on_each_load
+ true_possible_controllers = ActionController::Routing.possible_controllers
+ true_controller_paths = ActionController::Routing.controller_paths
+
+ ActionController::Routing.use_controllers! nil
+ root = File.dirname(__FILE__) + '/controller_fixtures'
+
+ ActionController::Routing.controller_paths = []
+ assert_equal [], ActionController::Routing.possible_controllers
+
+ ActionController::Routing::Routes.load!
+ ActionController::Routing.controller_paths = [
+ root, root + '/app/controllers', root + '/vendor/plugins/bad_plugin/lib'
+ ]
+
+ assert_equal ["admin/user", "plugin", "user"], ActionController::Routing.possible_controllers.sort
+ ensure
+ ActionController::Routing.controller_paths = true_controller_paths
+ ActionController::Routing.use_controllers! true_possible_controllers
+ Object.send(:remove_const, :RAILS_ROOT) rescue nil
+
+ ActionController::Routing::Routes.clear!
+ ActionController::Routing::Routes.load_routes!
+ end
+
def test_with_controllers
c = %w(admin/accounts admin/users account pages)
ActionController::Routing.with_controllers c do