aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorMatt Jones <al2o3cr@gmail.com>2008-09-07 10:21:34 -0500
committerJoshua Peek <josh@joshpeek.com>2008-09-07 10:21:34 -0500
commit7e6cda15f8dae517f9605f73aa1c966a29d4930a (patch)
tree822f74af40156d11fdcbd3031b0534bc8126e1f3 /actionpack/test
parent41efd73887c00ffd228b05d9346ec47a1f3759b9 (diff)
downloadrails-7e6cda15f8dae517f9605f73aa1c966a29d4930a.tar.gz
rails-7e6cda15f8dae517f9605f73aa1c966a29d4930a.tar.bz2
rails-7e6cda15f8dae517f9605f73aa1c966a29d4930a.zip
Ensure routing optimizations are cleared when new routes are added [#981 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/routing_test.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index 8bb1c49cbd..1eb26a7cfd 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -1375,6 +1375,36 @@ uses_mocha 'LegacyRouteSet, Route, RouteSet and RouteLoading' do
x.send(:foo_with_requirement_url, "I am Against the requirements")
end
end
+
+ def test_routes_changed_correctly_after_clear
+ ActionController::Base.optimise_named_routes = true
+ rs = ::ActionController::Routing::RouteSet.new
+ rs.draw do |r|
+ r.connect 'ca', :controller => 'ca', :action => "aa"
+ r.connect 'cb', :controller => 'cb', :action => "ab"
+ r.connect 'cc', :controller => 'cc', :action => "ac"
+ r.connect ':controller/:action/:id'
+ r.connect ':controller/:action/:id.:format'
+ end
+
+ hash = rs.recognize_path "/cc"
+
+ assert_not_nil hash
+ assert_equal %w(cc ac), [hash[:controller], hash[:action]]
+
+ rs.draw do |r|
+ r.connect 'cb', :controller => 'cb', :action => "ab"
+ r.connect 'cc', :controller => 'cc', :action => "ac"
+ r.connect ':controller/:action/:id'
+ r.connect ':controller/:action/:id.:format'
+ end
+
+ hash = rs.recognize_path "/cc"
+
+ assert_not_nil hash
+ assert_equal %w(cc ac), [hash[:controller], hash[:action]]
+
+ end
end
class RouteTest < Test::Unit::TestCase