aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing_test.rb
diff options
context:
space:
mode:
authorChris Arcand <chris@chrisarcand.com>2016-07-21 15:59:05 -0500
committerChris Arcand <chris@chrisarcand.com>2016-07-21 15:59:05 -0500
commit31fbbb7faccba25b2e3b5e10b8fca1468579d629 (patch)
treee04f75d020badc4ba2e210b1b54ef580b8af12a0 /actionpack/test/dispatch/routing_test.rb
parentf88495d519f9bdacd542d61b4e8117eb4f79c173 (diff)
downloadrails-31fbbb7faccba25b2e3b5e10b8fca1468579d629.tar.gz
rails-31fbbb7faccba25b2e3b5e10b8fca1468579d629.tar.bz2
rails-31fbbb7faccba25b2e3b5e10b8fca1468579d629.zip
Fix 'defaults' option for root route
The merging of the 'defaults' option was moved up the stack in e852daa This allows us to see where these options originate from the standard HttpHelpers (get, post, patch, put, delete) Unfortunately this move didn't incorporate the 'root' method, which has always allowed the same 'defaults' option before.
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r--actionpack/test/dispatch/routing_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index 5298e63fef..2fe40de583 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -1759,6 +1759,24 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
assert_equal 1, @request.params[:page]
end
+ def test_keyed_default_string_params_with_root
+ draw do
+ root :to => 'pages#show', :defaults => { :id => 'home' }
+ end
+
+ get '/'
+ assert_equal 'home', @request.params[:id]
+ end
+
+ def test_default_string_params_with_root
+ draw do
+ root :to => 'pages#show', :id => 'home'
+ end
+
+ get '/'
+ assert_equal 'home', @request.params[:id]
+ end
+
def test_resource_constraints
draw do
resources :products, :constraints => { :id => /\d{4}/ } do