diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2010-04-09 21:48:35 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-04-09 21:48:35 -0700 |
commit | ac0280c39dab272710c25d54810b21c10fff9c52 (patch) | |
tree | 8f5403bdb52126bf79330a972c9a8a0fbe095a60 /actionpack/test/dispatch | |
parent | e77a0311e59048f9f11cfda0ce976a93f4629122 (diff) | |
download | rails-ac0280c39dab272710c25d54810b21c10fff9c52.tar.gz rails-ac0280c39dab272710c25d54810b21c10fff9c52.tar.bz2 rails-ac0280c39dab272710c25d54810b21c10fff9c52.zip |
Routes can be selectively namespaced by path or controller module
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 6ff478aec1..a95f93537b 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -186,6 +186,14 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end resource :dashboard, :constraints => { :ip => /192\.168\.1\.\d{1,3}/ } + + namespace :controller => :api do + resource :token + end + + namespace :path => :api do + resource :me + end end end @@ -942,6 +950,22 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end end + def test_controller_namespace + with_test_routes do + get '/token' + assert_equal 'api/tokens#show', @response.body + assert_equal '/token', token_path + end + end + + def test_path_namespace + with_test_routes do + get '/api/me' + assert_equal 'mes#show', @response.body + assert_equal '/api/me', me_path + end + end + private def with_test_routes yield |