aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/routing_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-09-23 22:52:57 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-09-23 22:52:57 +0000
commitcb5b8a7f055966c1f3e2d65d09c1b914e82d2c39 (patch)
tree1da909365ccec0d80a950946e228c751effbebd6 /actionpack/test/controller/routing_test.rb
parentab09984d4ac6c99cad8e984dd0d9771790fa1d1d (diff)
downloadrails-cb5b8a7f055966c1f3e2d65d09c1b914e82d2c39.tar.gz
rails-cb5b8a7f055966c1f3e2d65d09c1b914e82d2c39.tar.bz2
rails-cb5b8a7f055966c1f3e2d65d09c1b914e82d2c39.zip
Optimized named routes respect AbstractRequest.relative_url_root. Closes #9612.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7605 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller/routing_test.rb')
-rw-r--r--actionpack/test/controller/routing_test.rb13
1 files changed, 9 insertions, 4 deletions
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index 9db0a4962b..d1e829390b 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -49,11 +49,13 @@ class LegacyRouteSetTests < Test::Unit::TestCase
def setup
# These tests assume optimisation is on, so re-enable it.
ActionController::Routing.optimise_named_routes = true
+
@rs = ::ActionController::Routing::RouteSet.new
@rs.draw {|m| m.connect ':controller/:action/:id' }
+
ActionController::Routing.use_controllers! %w(content admin/user admin/news_feed)
end
-
+
def test_default_setup
assert_equal({:controller => "content", :action => 'index'}, rs.recognize_path("/content"))
assert_equal({:controller => "content", :action => 'list'}, rs.recognize_path("/content/list"))
@@ -226,7 +228,7 @@ class LegacyRouteSetTests < Test::Unit::TestCase
end
x = setup_for_named_route
assert_equal("http://named.route.test/", x.send(:root_url))
- assert_equal("/", x.send(:root_path))
+ assert_equal("/relative/", x.send(:root_path))
end
def test_named_route_with_regexps
@@ -279,7 +281,7 @@ class LegacyRouteSetTests < Test::Unit::TestCase
# No / to %2F in URI, only for query params.
x = setup_for_named_route
- assert_equal("/file/hello/world", x.send(:path_path, 'hello/world'))
+ assert_equal("/relative/file/hello/world", x.send(:path_path, 'hello/world'))
end
def test_non_controllers_cannot_be_matched
@@ -918,6 +920,9 @@ uses_mocha 'RouteTest' do
(subdomains * '.') + '.' + domain
end
+ def relative_url_root
+ '/relative'
+ end
end
class RouteTest < Test::Unit::TestCase
@@ -2010,4 +2015,4 @@ class RoutingTest < Test::Unit::TestCase
assert c.ancestors.include?(h)
end
-end \ No newline at end of file
+end