diff options
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/routing_test.rb | 7 | ||||
-rw-r--r-- | actionpack/test/controller/url_rewriter_test.rb | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index 793e1d8cdf..c7b7f40e0d 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -189,7 +189,7 @@ class LegacyRouteSetTests < Test::Unit::TestCase end def test_named_route_with_nested_controller - rs.add_named_route :users, 'admin/user', :controller => '/admin/user', :action => 'index' + rs.add_named_route :users, '/admin/user', :controller => '/admin/user', :action => 'index' x = setup_for_named_route assert_equal("http://named.route.test/admin/user", x.send(:users_url)) @@ -198,12 +198,13 @@ class LegacyRouteSetTests < Test::Unit::TestCase uses_mocha "named route optimisation" do def test_optimised_named_route_call_never_uses_url_for rs.add_named_route :users, 'admin/user', :controller => '/admin/user', :action => 'index' + rs.add_named_route :user, 'admin/user/:id', :controller=>'/admin/user', :action=>'show' x = setup_for_named_route x.expects(:url_for).never x.send(:users_url) x.send(:users_path) - x.send(:users_url, :some_arg=>"some_value") - x.send(:users_path, :some_arg=>"some_value") + x.send(:user_url, 2, :foo=>"bar") + x.send(:user_path, 3, :bar=>"foo") end end diff --git a/actionpack/test/controller/url_rewriter_test.rb b/actionpack/test/controller/url_rewriter_test.rb index a49aaa822a..3c1d584d89 100644 --- a/actionpack/test/controller/url_rewriter_test.rb +++ b/actionpack/test/controller/url_rewriter_test.rb @@ -151,6 +151,7 @@ class UrlWriterTests < Test::Unit::TestCase def test_named_route ActionController::Routing::Routes.draw do |map| + map.no_args '/this/is/verbose', :controller => 'home', :action => 'index' map.home '/home/sweet/home/:user', :controller => 'home', :action => 'index' map.connect ':controller/:action/:id' end @@ -163,6 +164,8 @@ class UrlWriterTests < Test::Unit::TestCase controller.send(:home_url, :host => 'www.basecamphq.com', :user => 'again') assert_equal("/home/sweet/home/alabama", controller.send(:home_path, :user => 'alabama', :host => 'unused')) + assert_equal("http://www.basecamphq.com/home/sweet/home/alabama", controller.send(:home_url, :user => 'alabama', :host => 'www.basecamphq.com')) + assert_equal("http://www.basecamphq.com/this/is/verbose", controller.send(:no_args_url, :host=>'www.basecamphq.com')) ensure ActionController::Routing::Routes.load! end @@ -181,6 +184,7 @@ class UrlWriterTests < Test::Unit::TestCase controller.send(:url_for, :controller => 'brave', :action => 'new', :id => 'world', :only_path => true) assert_equal("/home/sweet/home/alabama", controller.send(:home_url, :user => 'alabama', :host => 'unused', :only_path => true)) + assert_equal("/home/sweet/home/alabama", controller.send(:home_path, 'alabama')) ensure ActionController::Routing::Routes.load! end |