aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-07-02 19:13:00 +0200
committerJosé Valim <jose.valim@gmail.com>2010-07-02 19:13:00 +0200
commit9e6e64873243ee707ecad3d523ceb0dbae0617cd (patch)
treebc3cf0338ab01a3d6b74e6ee42d4dcc8203fa5ae /actionpack/test/dispatch/routing_test.rb
parent0189fb76e3c38ef9a0d292135683b0d135c4a369 (diff)
downloadrails-9e6e64873243ee707ecad3d523ceb0dbae0617cd.tar.gz
rails-9e6e64873243ee707ecad3d523ceb0dbae0617cd.tar.bz2
rails-9e6e64873243ee707ecad3d523ceb0dbae0617cd.zip
Fix routes with :controller segment when namespaced [#5034 state:resolved]
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r--actionpack/test/dispatch/routing_test.rb24
1 files changed, 19 insertions, 5 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 26bd641cd6..1bfc92aa3d 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -310,11 +310,6 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
match '/' => 'mes#index'
end
- namespace :private do
- root :to => redirect('/private/index')
- match "index", :to => 'private#index'
- end
-
get "(/:username)/followers" => "followers#index"
get "/groups(/user/:username)" => "groups#index"
get "(/user/:username)/photos" => "photos#index"
@@ -348,6 +343,12 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
+ namespace :private do
+ root :to => redirect('/private/index')
+ match "index", :to => 'private#index'
+ match ":controller(/:action(/:id))"
+ end
+
match '/:locale/*file.:format', :to => 'files#show', :file => /path\/to\/existing\/file/
end
end
@@ -470,6 +471,19 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
+ def test_namespace_with_controller_segment
+ with_test_routes do
+ get '/private/foo'
+ assert_equal 'private/foo#index', @response.body
+
+ get '/private/foo/bar'
+ assert_equal 'private/foo#bar', @response.body
+
+ get '/private/foo/bar/1'
+ assert_equal 'private/foo#bar', @response.body
+ end
+ end
+
def test_session_singleton_resource
with_test_routes do
get '/session'