aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2012-11-22 01:27:14 -0800
committerAndrew White <andyw@pixeltrix.co.uk>2012-11-22 01:27:14 -0800
commit9f68d524baa82e12dabe35f9693b6522327fc44d (patch)
tree75f026fea3004c101fe5bbb958ced64fc75d3a4b /actionpack/test
parent0134ca6a0166bfddd5e6e238877c3212824f0e6e (diff)
parent0d3a9e8a6b30d2bae09209eecfb3380f8c600eb6 (diff)
downloadrails-9f68d524baa82e12dabe35f9693b6522327fc44d.tar.gz
rails-9f68d524baa82e12dabe35f9693b6522327fc44d.tar.bz2
rails-9f68d524baa82e12dabe35f9693b6522327fc44d.zip
Merge pull request #8114 from guilleiguaran/use-symbols-in-scope
Allow setting a symbol as path in scope on routes
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/dispatch/routing_test.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 34606512dc..0a59d3cf9e 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -370,6 +370,14 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
scope :path => 'api' do
resource :me
get '/' => 'mes#index'
+ scope :v2 do
+ resource :me, as: 'v2_me'
+ get '/' => 'mes#index'
+ end
+
+ scope :v3, :admin do
+ resource :me, as: 'v3_me'
+ end
end
get "(/:username)/followers" => "followers#index"
@@ -1467,6 +1475,18 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
assert_equal 'mes#index', @response.body
end
+ def test_symbol_scope
+ get '/api/v2/me'
+ assert_equal 'mes#show', @response.body
+ assert_equal '/api/v2/me', v2_me_path
+
+ get '/api/v2'
+ assert_equal 'mes#index', @response.body
+
+ get '/api/v3/admin/me'
+ assert_equal 'mes#show', @response.body
+ end
+
def test_url_generator_for_generic_route
get 'whatever/foo/bar'
assert_equal 'foo#bar', @response.body