From 9088f0f9f3b650f0bae46854a1d75eb7393d4f8e Mon Sep 17 00:00:00 2001 From: Balazs Nagy Date: Tue, 9 Feb 2010 08:24:38 +0100 Subject: [PATCH 1/3] Test shallow nesting Signed-off-by: Balazs Nagy --- actionpack/test/dispatch/routing_test.rb | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index bcb97e4..6f77281 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -155,6 +155,13 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest resources :descriptions root :to => 'projects#index' end + + # http://guides.rails.info/routing.html#shallow-nesting + resources :publishers, :shallow => true do + resources :magazines do + resources :photos + end + end end end @@ -719,6 +726,17 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end end + # http://guides.rails.info/routing.html#shallow-nesting + def test_shallow_nesting + with_test_routes do + assert_equal '/publishers/1', publisher_path(1) + assert_equal '/publishers/1/magazines', publisher_magazines_path(1) + assert_equal '/magazines/2', magazine_path(2) + assert_equal '/magazines/2/photos', magazines_photos_path(2) + assert_equal '/photos/3', photo_path(3) + end + end + private def with_test_routes real_routes, temp_routes = ActionController::Routing::Routes, Routes -- 1.6.6.1