diff options
author | wycats <wycats@gmail.com> | 2010-03-26 15:10:24 -0700 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-03-26 15:10:24 -0700 |
commit | 197904341f2b2f21d69c653cede3aec124e86720 (patch) | |
tree | 83f1234e238016126860a929594db22e1862d783 /actionpack/test/dispatch/routing_test.rb | |
parent | 76d2c455c0607b4cd5f238cadef8f933a18567fb (diff) | |
parent | b3a0aed028835ce4551c4a76742744a40a71b0be (diff) | |
download | rails-197904341f2b2f21d69c653cede3aec124e86720.tar.gz rails-197904341f2b2f21d69c653cede3aec124e86720.tar.bz2 rails-197904341f2b2f21d69c653cede3aec124e86720.zip |
Merge branch 'master' into docrails
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index f5fcf9b0df..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 @@ -34,6 +33,8 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest match 'account/login', :to => redirect("/login") 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}" } @@ -121,6 +122,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest match 'articles/:year/:month/:day/:title', :to => "articles#show", :as => :article namespace :account do + match 'shorthand' match 'description', :to => "account#description", :as => "description" resource :subscription, :credit, :credit_card @@ -193,6 +195,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest assert_equal '/login', url_for(:controller => 'sessions', :action => 'new', :only_path => true) assert_equal 'http://rubyonrails.org/login', Routes.url_for(:controller => 'sessions', :action => 'create') + assert_equal 'http://rubyonrails.org/login', Routes.url_helpers.login_url end end @@ -654,6 +657,30 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end end + def test_convention_match_inside_namespace + with_test_routes do + assert_equal '/account/shorthand', account_shorthand_path + get '/account/shorthand' + assert_equal 'account#shorthand', @response.body + end + end + + def test_convention_match_nested_and_with_leading_slash + with_test_routes do + assert_equal '/account/nested/overview', account_nested_overview_path + get '/account/nested/overview' + assert_equal 'account/nested#overview', @response.body + 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' |