aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2009-12-27 14:13:03 -0800
committerDavid Heinemeier Hansson <david@loudthinking.com>2009-12-27 14:13:03 -0800
commit95762cbbb3528bcb6a1a8119795df9647daaaab6 (patch)
treea02340f8d1eb0204b0f81afb27f421f54c45abfa /actionpack/test/dispatch/routing_test.rb
parent5565bab994af1e54f34df5891c635590d22feea0 (diff)
downloadrails-95762cbbb3528bcb6a1a8119795df9647daaaab6.tar.gz
rails-95762cbbb3528bcb6a1a8119795df9647daaaab6.tar.bz2
rails-95762cbbb3528bcb6a1a8119795df9647daaaab6.zip
Added shorthand for match 'products/overview' that expands to match 'products/overview', :to => 'products#overview', :as => 'products_overview'
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r--actionpack/test/dispatch/routing_test.rb22
1 files changed, 16 insertions, 6 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 360ffe977b..c4b0b9cdbf 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -16,25 +16,27 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
Routes = routes
Routes.draw do
controller :sessions do
- get 'login', :to => :new, :as => :login
- post 'login', :to => :create
+ get 'login' => :new, :as => :login
+ post 'login' => :create
- delete 'logout', :to => :destroy, :as => :logout
+ delete 'logout' => :destroy, :as => :logout
end
match 'account/logout' => redirect("/logout"), :as => :logout_redirect
match 'account/login', :to => redirect("/login")
+ match 'account/overview'
+
match 'account/modulo/:name', :to => redirect("/%{name}s")
match 'account/proc/:name', :to => redirect {|params| "/#{params[:name].pluralize}" }
match 'openid/login', :via => [:get, :post], :to => "openid#login"
controller(:global) do
- match 'global/:action'
+ get 'global/hide_notice'
match 'global/export', :to => :export, :as => :export_request
- match 'global/hide_notice', :to => :hide_notice, :as => :hide_notice
match '/export/:id/:file', :to => :export, :as => :export_download, :constraints => { :file => /.*/ }
+ match 'global/:action'
end
constraints(:ip => /192\.168\.1\.\d\d\d/) do
@@ -221,7 +223,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
assert_equal 'global#export', @response.body
assert_equal '/global/export', export_request_path
- assert_equal '/global/hide_notice', hide_notice_path
+ assert_equal '/global/hide_notice', global_hide_notice_path
assert_equal '/export/123/foo.txt', export_download_path(:id => 123, :file => 'foo.txt')
end
end
@@ -486,6 +488,14 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
assert_equal 'projects#info', @response.body
end
end
+
+ def test_convention_match_with_no_scope
+ with_test_routes do
+ assert_equal '/account/overview', account_overview_path
+ get '/account/overview'
+ assert_equal 'account#overview', @response.body
+ end
+ end
private
def with_test_routes