aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorMikel Lindsaar <raasdnil@gmail.com>2010-06-08 00:10:11 -0400
committerMikel Lindsaar <raasdnil@gmail.com>2010-06-08 00:10:11 -0400
commite404490f9bae102f8c7126917d59568e6d1fef79 (patch)
tree34a4fd7517026ab23498e7d2301f27ebd75cdee2 /actionpack/test
parent80a044edb663e6bc619b0755e30f9db10e37e9e8 (diff)
parent8d576b51a12fdb19e3993f3678ec64b2ea60fada (diff)
downloadrails-e404490f9bae102f8c7126917d59568e6d1fef79.tar.gz
rails-e404490f9bae102f8c7126917d59568e6d1fef79.tar.bz2
rails-e404490f9bae102f8c7126917d59568e6d1fef79.zip
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/dispatch/routing_test.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index ffa4f50b00..82c45f3161 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -34,6 +34,33 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
+ resources :users do
+ shallow do
+ resources :photos do
+ resources :types do
+ member do
+ post :preview
+ end
+ collection do
+ delete :erase
+ end
+ end
+ end
+ end
+ end
+
+ shallow do
+ resources :teams do
+ resources :players
+ end
+
+ resources :countries do
+ resources :cities do
+ resources :places
+ end
+ end
+ end
+
match 'account/logout' => redirect("/logout"), :as => :logout_redirect
match 'account/login', :to => redirect("/login")
@@ -728,6 +755,18 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
+ def test_shallow_routes
+ with_test_routes do
+ assert_equal '/photos/4', photo_path(4)
+ assert_equal '/types/10/edit', edit_type_path(10)
+ assert_equal '/types/5/preview', preview_type_path(5)
+ assert_equal '/photos/2/types', photo_types_path(2)
+ assert_equal '/cities/1/places', url_for(:controller => :places, :action => :index, :city_id => 1, :only_path => true)
+ assert_equal '/teams/new', url_for(:controller => :teams, :action => :new, :only_path => true)
+ assert_equal '/photos/11/types/erase', url_for(:controller => :types, :action => :erase, :photo_id => 11, :only_path => true)
+ end
+ end
+
def test_update_project_person
with_test_routes do
get '/projects/1/people/2/update'