aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing_test.rb
diff options
context:
space:
mode:
authorAndrew White <andyw@pixeltrix.co.uk>2010-08-20 08:33:48 +0100
committerJosé Valim <jose.valim@gmail.com>2010-08-20 09:32:48 -0300
commit771d2f918fc87bdd4f83e6666fd816e9f0dcedfb (patch)
tree869060290b887eb0186ac87da9af2da0489deef0 /actionpack/test/dispatch/routing_test.rb
parent43291469cb1587f8f48ce96d79487bbffa6bc29f (diff)
downloadrails-771d2f918fc87bdd4f83e6666fd816e9f0dcedfb.tar.gz
rails-771d2f918fc87bdd4f83e6666fd816e9f0dcedfb.tar.bz2
rails-771d2f918fc87bdd4f83e6666fd816e9f0dcedfb.zip
Allow symbols for :path resource(s) option [#5306 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r--actionpack/test/dispatch/routing_test.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index fa8447efae..739b892c78 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -385,6 +385,9 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
+ resources :wiki_pages, :path => :pages
+ resource :wiki_account, :path => :my_account
+
scope :only => :show do
namespace :only do
resources :sectors, :only => :index do
@@ -1984,6 +1987,22 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
+ def test_resources_path_can_be_a_symbol
+ with_test_routes do
+ get '/pages'
+ assert_equal 'wiki_pages#index', @response.body
+ assert_equal '/pages', wiki_pages_path
+
+ get '/pages/Ruby_on_Rails'
+ assert_equal 'wiki_pages#show', @response.body
+ assert_equal '/pages/Ruby_on_Rails', wiki_page_path(:id => 'Ruby_on_Rails')
+
+ get '/my_account'
+ assert_equal 'wiki_accounts#show', @response.body
+ assert_equal '/my_account', wiki_account_path
+ end
+ end
+
private
def with_test_routes
yield