aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing_test.rb
diff options
context:
space:
mode:
authorrono23 <rono23@gmail.com>2015-01-13 19:40:56 +0900
committerrono23 <rono23@gmail.com>2015-01-19 10:32:27 +0900
commit8a8dac80bb9aa173617a456f187b3fff56b4c347 (patch)
treec3a7d47e437efa5e037ef1861c446790bd691314 /actionpack/test/dispatch/routing_test.rb
parent19b4b0dff1820b13db35b7a75dfb7d06f7240ecf (diff)
downloadrails-8a8dac80bb9aa173617a456f187b3fff56b4c347.tar.gz
rails-8a8dac80bb9aa173617a456f187b3fff56b4c347.tar.bz2
rails-8a8dac80bb9aa173617a456f187b3fff56b4c347.zip
Fix name_for_action in routing
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r--actionpack/test/dispatch/routing_test.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 450681c356..3373705326 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -3439,6 +3439,44 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
assert_equal '/bar/comments/1', comment_path('1')
end
+ def test_resource_where_as_is_empty
+ draw do
+ resource :post, as: ''
+
+ scope 'post', as: 'post' do
+ resource :comment, as: ''
+ end
+ end
+
+ assert_equal '/post/new', new_path
+ assert_equal '/post/comment/new', new_post_path
+ end
+
+ def test_resources_where_as_is_empty
+ draw do
+ resources :posts, as: ''
+
+ scope 'posts', as: 'posts' do
+ resources :comments, as: ''
+ end
+ end
+
+ assert_equal '/posts/new', new_path
+ assert_equal '/posts/comments/new', new_posts_path
+ end
+
+ def test_scope_where_as_is_empty
+ draw do
+ scope 'post', as: '' do
+ resource :user
+ resources :comments
+ end
+ end
+
+ assert_equal '/post/user/new', new_user_path
+ assert_equal '/post/comments/new', new_comment_path
+ end
+
private
def draw(&block)