aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-01-26 00:55:26 +0100
committerJosé Valim <jose.valim@gmail.com>2010-01-26 00:55:26 +0100
commit8974dac92e05dcab8ee552a5f40108c6ac25dc36 (patch)
tree809ee7a5295caa44041a59110b40b31b54d4bcfa /actionpack/test/dispatch/routing_test.rb
parent5d078692453c454289823700b67e64bcd4c8de7f (diff)
downloadrails-8974dac92e05dcab8ee552a5f40108c6ac25dc36.tar.gz
rails-8974dac92e05dcab8ee552a5f40108c6ac25dc36.tar.bz2
rails-8974dac92e05dcab8ee552a5f40108c6ac25dc36.zip
Ensure root routes inside optional scopes works as expected.
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r--actionpack/test/dispatch/routing_test.rb21
1 files changed, 14 insertions, 7 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 6dccabdb3f..dfe824fd70 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -141,19 +141,18 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
resources :rooms
end
- scope '(:locale)', :locale => /en|pl/ do
- resources :descriptions
- end
+ match '/info' => 'projects#info', :as => 'info'
namespace :admin do
- scope '(/:locale)', :locale => /en|pl/ do
+ scope '(:locale)', :locale => /en|pl/ do
resources :descriptions
end
end
- match '/info' => 'projects#info', :as => 'info'
-
- root :to => 'projects#index'
+ scope '(:locale)', :locale => /en|pl/ do
+ resources :descriptions
+ root :to => 'projects#index'
+ end
end
end
@@ -660,6 +659,14 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
+ def test_optional_scoped_root
+ with_test_routes do
+ assert_equal '/en', root_path("en")
+ get '/en'
+ assert_equal 'projects#index', @response.body
+ end
+ end
+
def test_optional_scoped_path
with_test_routes do
assert_equal '/en/descriptions', descriptions_path("en")