aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-07-12 15:11:15 +0200
committerJosé Valim <jose.valim@gmail.com>2010-07-12 15:11:53 +0200
commit3d7e4119539f373720bc9aa398ecbb6542c7dc21 (patch)
treeb435cd5624e0d22dd621913e070fedeb8e9f923e /actionpack/test/dispatch/routing_test.rb
parent725090942f698f334b42c332036c571640697a52 (diff)
downloadrails-3d7e4119539f373720bc9aa398ecbb6542c7dc21.tar.gz
rails-3d7e4119539f373720bc9aa398ecbb6542c7dc21.tar.bz2
rails-3d7e4119539f373720bc9aa398ecbb6542c7dc21.zip
Routes should respect namespace even if action is a regexp and just controller is given to to.
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r--actionpack/test/dispatch/routing_test.rb18
1 files changed, 15 insertions, 3 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 2a014bf976..4808663aa9 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -245,7 +245,8 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
namespace :account do
match 'shorthand'
- match 'description', :to => "description", :as => "description"
+ match 'description', :to => :description, :as => "description"
+ match ':action/callback', :action => /twitter|github/, :to => "callbacks", :as => :callback
resource :subscription, :credit, :credit_card
root :to => "account#index"
@@ -1159,7 +1160,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
- def test_convention_match_with_no_scope
+ def test_match_shorthand_with_no_scope
with_test_routes do
assert_equal '/account/overview', account_overview_path
get '/account/overview'
@@ -1167,7 +1168,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
- def test_convention_match_inside_namespace
+ def test_match_shorthand_inside_namespace
with_test_routes do
assert_equal '/account/shorthand', account_shorthand_path
get '/account/shorthand'
@@ -1175,6 +1176,17 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
+ def test_scoped_controller_with_namespace_and_action
+ with_test_routes do
+ assert_equal '/account/twitter/callback', account_callback_path("twitter")
+ get '/account/twitter/callback'
+ assert_equal 'account/callbacks#twitter', @response.body
+
+ get '/account/whatever/callback'
+ assert_equal 'Not Found', @response.body
+ end
+ end
+
def test_convention_match_nested_and_with_leading_slash
with_test_routes do
assert_equal '/account/nested/overview', account_nested_overview_path