diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2010-03-26 12:16:25 +0000 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-03-27 00:21:10 -0700 |
commit | 3d746fcdb584767c476408f395320e934fd5383e (patch) | |
tree | 29b5426da20d7840d717effe405077d085ad59e6 /actionpack/test/dispatch | |
parent | b20a105ed0d52bf1490cf0fad97e0b3268ba63fd (diff) | |
download | rails-3d746fcdb584767c476408f395320e934fd5383e.tar.gz rails-3d746fcdb584767c476408f395320e934fd5383e.tar.bz2 rails-3d746fcdb584767c476408f395320e934fd5383e.zip |
Add parameter defaults support to new routing DSL [#4265 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
Diffstat (limited to 'actionpack/test/dispatch')
-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 |