aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2013-02-21 17:43:49 +0100
committerYves Senn <yves.senn@gmail.com>2013-02-22 09:04:04 +0100
commita72dab0b6a16ef9e83e66c665b0f2b4364d90fb6 (patch)
tree1c7d1432c397d9834835f164b361fd8e1be191bb /actionpack/test/dispatch
parentfdcd7c0f2ee264219c322e5cb8f880ca48e14d5f (diff)
downloadrails-a72dab0b6a16ef9e83e66c665b0f2b4364d90fb6.tar.gz
rails-a72dab0b6a16ef9e83e66c665b0f2b4364d90fb6.tar.bz2
rails-a72dab0b6a16ef9e83e66c665b0f2b4364d90fb6.zip
determine the match shorthand target early.
Backport #9361. Closes #7554. This patch determines the `controller#action` directly in the `match` method when the shorthand syntax is used. this prevents problems with namespaces and scopes.
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r--actionpack/test/dispatch/routing_test.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 6ecf011694..b922235944 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -517,6 +517,18 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
get 'search' => 'search'
+
+ scope ':locale' do
+ match 'questions/new', via: [:get]
+ end
+
+ namespace :api do
+ namespace :v3 do
+ scope ':locale' do
+ get "products/list"
+ end
+ end
+ end
end
end
@@ -1417,6 +1429,21 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
+ def test_match_shorthand_inside_scope_with_variables_with_controller
+ with_test_routes do
+ get '/de/questions/new'
+ assert_equal 'questions#new', @response.body
+ assert_equal 'de', @request.params[:locale]
+ end
+ end
+
+ def test_match_shorthand_inside_nested_namespaces_and_scopes_with_controller
+ with_test_routes do
+ get '/api/v3/en/products/list'
+ assert_equal 'api/v3/products#list', @response.body
+ end
+ end
+
def test_dynamically_generated_helpers_on_collection_do_not_clobber_resources_url_helper
with_test_routes do
assert_equal '/replies', replies_path