diff options
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 87a46feec7..cbe9b5488c 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -121,6 +121,13 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest # misc match 'articles/:year/:month/:day/:title', :to => "articles#show", :as => :article + # default params + match 'inline_pages/(:id)', :to => 'pages#show', :id => 'home' + match 'default_pages/(:id)', :to => 'pages#show', :defaults => { :id => 'home' } + defaults :id => 'home' do + match 'scoped_pages/(:id)', :to => 'pages#show' + end + namespace :account do match 'shorthand' match 'description', :to => "account#description", :as => "description" @@ -769,6 +776,19 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest end end + def test_default_params + with_test_routes do + get '/inline_pages' + assert_equal 'home', @request.params[:id] + + get '/default_pages' + assert_equal 'home', @request.params[:id] + + get '/scoped_pages' + assert_equal 'home', @request.params[:id] + end + end + private def with_test_routes yield |