aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2009-12-20 20:37:36 -0800
committerDavid Heinemeier Hansson <david@loudthinking.com>2009-12-20 20:37:36 -0800
commit3ff9e9ee147b682cb13aed4c057e750228892f42 (patch)
tree9bdc91718b07b3c50837e78ecddf44685c2896f9 /actionpack/test/dispatch/routing_test.rb
parent8763b78f8949f904dd0b53017555451b83f06884 (diff)
downloadrails-3ff9e9ee147b682cb13aed4c057e750228892f42.tar.gz
rails-3ff9e9ee147b682cb13aed4c057e750228892f42.tar.bz2
rails-3ff9e9ee147b682cb13aed4c057e750228892f42.zip
Its now possible to use match 'stuff' => 'what#stuff' instead of using the :to for simple routes
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r--actionpack/test/dispatch/routing_test.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 7145a0c530..7058bc2ea0 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -22,6 +22,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
delete 'logout', :to => :destroy, :as => :logout
end
+ match 'account/logout' => redirect("/logout")
match 'account/login', :to => redirect("/login")
match 'account/modulo/:name', :to => redirect("/%{name}s")
@@ -37,11 +38,11 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
constraints(:ip => /192\.168\.1\.\d\d\d/) do
- get 'admin', :to => "queenbee#index"
+ get 'admin' => "queenbee#index"
end
constraints ::TestRoutingMapper::IpRestrictor do
- get 'admin/accounts', :to => "queenbee#accounts"
+ get 'admin/accounts' => "queenbee#accounts"
end
resources :projects, :controller => :project do
@@ -85,7 +86,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
- match 'sprockets.js', :to => ::TestRoutingMapper::SprocketsApp
+ match 'sprockets.js' => ::TestRoutingMapper::SprocketsApp
match 'people/:id/update', :to => 'people#update', :as => :update_person
match '/projects/:project_id/people/:id/update', :to => 'people#update', :as => :update_project_person
@@ -148,6 +149,15 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
+ def test_logout_redirect_without_to
+ with_test_routes do
+ get '/account/logout'
+ assert_equal 301, @response.status
+ assert_equal 'http://www.example.com/logout', @response.headers['Location']
+ assert_equal 'Moved Permanently', @response.body
+ end
+ end
+
def test_redirect_modulo
with_test_routes do
get '/account/modulo/name'