aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-03-26 15:41:05 +0100
committerJosé Valim <jose.valim@gmail.com>2010-03-26 15:51:51 +0100
commitb2c2b0ce459a215d389f3ab8bb9e33718460cf51 (patch)
tree8215d6ec113d603c9194de9ac619db17970b09a5 /actionpack/test/dispatch/routing_test.rb
parentf5ee855f439feb7958504dc1d8e62aad4da5fac6 (diff)
downloadrails-b2c2b0ce459a215d389f3ab8bb9e33718460cf51.tar.gz
rails-b2c2b0ce459a215d389f3ab8bb9e33718460cf51.tar.bz2
rails-b2c2b0ce459a215d389f3ab8bb9e33718460cf51.zip
Rails router automatically calculated for you the controller and named routes in the following scenarios:
match "home/about" #=> maps to home#about with named route home_about_path match "about" #=> does not work because it cannot guess the controller match "about" => "home#about" #=> maps to home#about with named route home_about_path match "home/about", :as => "about" #=> maps to home#about with named route about_path
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r--actionpack/test/dispatch/routing_test.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index e0500af29d..87a46feec7 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -18,10 +18,9 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
default_url_options :host => "rubyonrails.org"
controller :sessions do
- get 'login' => :new, :as => :login
+ get 'login' => :new
post 'login' => :create
-
- delete 'logout' => :destroy, :as => :logout
+ delete 'logout' => :destroy
end
resource :session do
@@ -35,6 +34,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
match 'account/overview'
match '/account/nested/overview'
+ match 'sign_in' => "sessions#new"
match 'account/modulo/:name', :to => redirect("/%{name}s")
match 'account/proc/:name', :to => redirect {|params| "/#{params[:name].pluralize}" }
@@ -673,6 +673,14 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
end
end
+ def test_convention_with_explicit_end
+ with_test_routes do
+ get '/sign_in'
+ assert_equal 'sessions#new', @response.body
+ assert_equal '/sign_in', sign_in_path
+ end
+ end
+
def test_redirect_with_complete_url
with_test_routes do
get '/account/google'