aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2019-04-02 19:32:13 -0400
committerGitHub <noreply@github.com>2019-04-02 19:32:13 -0400
commit798f175c65bbfd95b3fa0dd639ca08ae8485d5d1 (patch)
tree775e8b64f3be1a6c1b8a6ef626fbdf5940c1fc98 /actionpack/test/dispatch
parent6c6c579a9b72ee676b24a900bebe3e5df161c119 (diff)
parente09e600a48e525553767da5a1ec2e756fe62aac4 (diff)
downloadrails-798f175c65bbfd95b3fa0dd639ca08ae8485d5d1.tar.gz
rails-798f175c65bbfd95b3fa0dd639ca08ae8485d5d1.tar.bz2
rails-798f175c65bbfd95b3fa0dd639ca08ae8485d5d1.zip
Merge pull request #24405 from waits/shallow-false
Honor shallow: false on nested resources
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r--actionpack/test/dispatch/routing_test.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 4645ba476f..de0c9f3460 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -2200,6 +2200,37 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
assert_equal "cards#destroy", @response.body
end
+ def test_shallow_false_inside_nested_shallow_resource
+ draw do
+ resources :blogs, shallow: true do
+ resources :posts do
+ resources :comments, shallow: false
+ resources :tags
+ end
+ end
+ end
+
+ get '/posts/1/comments'
+ assert_equal 'comments#index', @response.body
+ assert_equal '/posts/1/comments', post_comments_path('1')
+
+ get '/posts/1/comments/new'
+ assert_equal 'comments#new', @response.body
+ assert_equal '/posts/1/comments/new', new_post_comment_path('1')
+
+ get '/posts/1/comments/2'
+ assert_equal 'comments#show', @response.body
+ assert_equal '/posts/1/comments/2', post_comment_path('1', '2')
+
+ get '/posts/1/comments/2/edit'
+ assert_equal 'comments#edit', @response.body
+ assert_equal '/posts/1/comments/2/edit', edit_post_comment_path('1', '2')
+
+ get '/tags/3'
+ assert_equal 'tags#show', @response.body
+ assert_equal '/tags/3', tag_path('3')
+ end
+
def test_shallow_deeply_nested_resources
draw do
resources :blogs do