From 03be27092bf51e78d0d3f3ee7fd0213023d43e0d Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 8 Jun 2010 16:20:46 -0400 Subject: Revert "Add shallow routes to the new router" for now. Needs more work. This reverts commit 67a60ee314f53abcde78f8ecd2a1f7c9ef8264e1. --- actionpack/test/dispatch/routing_test.rb | 39 -------------------------------- 1 file changed, 39 deletions(-) (limited to 'actionpack/test/dispatch') diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index a294535e88..5c46f9b971 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -34,33 +34,6 @@ 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") @@ -779,18 +752,6 @@ 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' -- cgit v1.2.3 From 4560385fa4fa6925aa220bbaf6b2608c2bbd7039 Mon Sep 17 00:00:00 2001 From: Jan De Poorter Date: Wed, 14 Apr 2010 10:34:42 +0200 Subject: Make sure namespaces are nested within resources MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- actionpack/test/dispatch/routing_test.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'actionpack/test/dispatch') diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 5c46f9b971..c4e402afd3 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -144,6 +144,12 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest resources :sheep + resources :clients do + namespace :google do + resource :account + end + end + match 'sprockets.js' => ::TestRoutingMapper::SprocketsApp match 'people/:id/update', :to => 'people#update', :as => :update_person @@ -813,6 +819,15 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest assert_equal '/account/admin/subscription', account_admin_subscription_path end end + + def test_namespace_nested_in_resources + with_test_routes do + get '/clients/1/google/account' + assert_equal '/clients/1/google/account', client_google_account_path(1) + + assert_equal 'google/accounts#show', @response.body + end + end def test_articles_with_id with_test_routes do -- cgit v1.2.3 From 5c9f27abaabba0d008ccd710ed1af5f6caa4e371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 8 Jun 2010 23:26:51 +0200 Subject: Add more cases to previous commit [#4394 state:resolved] --- actionpack/test/dispatch/routing_test.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'actionpack/test/dispatch') diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index c4e402afd3..e13960e0dc 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -146,7 +146,11 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest resources :clients do namespace :google do - resource :account + resource :account do + namespace :secret do + resource :info + end + end end end @@ -824,8 +828,11 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest with_test_routes do get '/clients/1/google/account' assert_equal '/clients/1/google/account', client_google_account_path(1) - assert_equal 'google/accounts#show', @response.body + + get '/clients/1/google/account/secret/info' + assert_equal '/clients/1/google/account/secret/info', client_google_account_secret_info_path(1) + assert_equal 'google/secret/infos#show', @response.body end end -- cgit v1.2.3 From c4d6245e875bbb276c122a5a401422d341dac4df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20A=CC=81lvarez?= Date: Thu, 10 Jun 2010 11:41:32 +0200 Subject: Add support for multi-subdomain session by setting cookie host in session cookie so you can share session between www.example.com, example.com and user.example.com. [#4818 state:resolved] Signed-off-by: David Heinemeier Hansson --- .../test/dispatch/session/cookie_store_test.rb | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'actionpack/test/dispatch') diff --git a/actionpack/test/dispatch/session/cookie_store_test.rb b/actionpack/test/dispatch/session/cookie_store_test.rb index 21d11ff31c..b542824789 100644 --- a/actionpack/test/dispatch/session/cookie_store_test.rb +++ b/actionpack/test/dispatch/session/cookie_store_test.rb @@ -185,6 +185,35 @@ class CookieStoreTest < ActionController::IntegrationTest end end + def test_session_store_with_explicit_domain + with_test_route_set(:domain => "example.es") do + get '/set_session_value' + assert_match /domain=example\.es/, headers['Set-Cookie'] + headers['Set-Cookie'] + end + end + + def test_session_store_without_domain + with_test_route_set do + get '/set_session_value' + assert_no_match /domain\=/, headers['Set-Cookie'] + end + end + + def test_session_store_with_nil_domain + with_test_route_set(:domain => nil) do + get '/set_session_value' + assert_no_match /domain\=/, headers['Set-Cookie'] + end + end + + def test_session_store_with_all_domains + with_test_route_set(:domain => :all) do + get '/set_session_value' + assert_match /domain=\.example\.com/, headers['Set-Cookie'] + end + end + private # Overwrite get to send SessionSecret in env hash -- cgit v1.2.3 From 330a89072a493aafef1e07c3558964477f85adf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Thu, 10 Jun 2010 20:05:48 +0200 Subject: Revert "Add support for multi-subdomain session by setting cookie host in session cookie so you can share session between www.example.com, example.com and user.example.com. [#4818 state:resolved]" It does not work for domains like co.uk and com.br. This reverts commit c4d6245e875bbb276c122a5a401422d341dac4df. --- .../test/dispatch/session/cookie_store_test.rb | 29 ---------------------- 1 file changed, 29 deletions(-) (limited to 'actionpack/test/dispatch') diff --git a/actionpack/test/dispatch/session/cookie_store_test.rb b/actionpack/test/dispatch/session/cookie_store_test.rb index b542824789..21d11ff31c 100644 --- a/actionpack/test/dispatch/session/cookie_store_test.rb +++ b/actionpack/test/dispatch/session/cookie_store_test.rb @@ -185,35 +185,6 @@ class CookieStoreTest < ActionController::IntegrationTest end end - def test_session_store_with_explicit_domain - with_test_route_set(:domain => "example.es") do - get '/set_session_value' - assert_match /domain=example\.es/, headers['Set-Cookie'] - headers['Set-Cookie'] - end - end - - def test_session_store_without_domain - with_test_route_set do - get '/set_session_value' - assert_no_match /domain\=/, headers['Set-Cookie'] - end - end - - def test_session_store_with_nil_domain - with_test_route_set(:domain => nil) do - get '/set_session_value' - assert_no_match /domain\=/, headers['Set-Cookie'] - end - end - - def test_session_store_with_all_domains - with_test_route_set(:domain => :all) do - get '/set_session_value' - assert_match /domain=\.example\.com/, headers['Set-Cookie'] - end - end - private # Overwrite get to send SessionSecret in env hash -- cgit v1.2.3