aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing_test.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2016-08-17 16:09:34 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2016-08-17 16:09:34 -0300
commit4c91c442295fdea93ef1a7c44c28fcd3bf407323 (patch)
tree9755f9b4f88cf4aa689325050bcc0fba984dc547 /actionpack/test/dispatch/routing_test.rb
parentf857e1fd8c5bf74fd1d4449e8336a262630e217e (diff)
downloadrails-4c91c442295fdea93ef1a7c44c28fcd3bf407323.tar.gz
rails-4c91c442295fdea93ef1a7c44c28fcd3bf407323.tar.bz2
rails-4c91c442295fdea93ef1a7c44c28fcd3bf407323.zip
Push :defaults extraction down one level
Since e852daa6976cc6b6b28ad0c80a188c06e226df3c only the verb methods where extracting the defaults options. It was merged a fix for the `root` method in 31fbbb7faccba25b2e3b5e10b8fca1468579d629 but `match` was still broken since `:defaults` where not extracted. This was causing routes defined using `match` and having the `:defaults` keys to not be recognized. To fix this it was extracted a new private method with the actual content of `match` and the `:defaults` extracting was moved to `match`.
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 56be08f54f..ee5c30ef0e 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_match
+ draw do
+ match "/", to: "pages#show", via: :get, defaults: { id: "home" }
+ end
+
+ get "/"
+ assert_equal "home", @request.params[:id]
+ end
+
+ def test_default_string_params_with_match
+ draw do
+ match "/", to: "pages#show", via: :get, id: "home"
+ end
+
+ get "/"
+ assert_equal "home", @request.params[:id]
+ end
+
def test_keyed_default_string_params_with_root
draw do
root to: "pages#show", defaults: { id: "home" }