diff options
author | Josua Schmid <josua.schmid@renuo.ch> | 2019-02-12 16:58:59 +0100 |
---|---|---|
committer | Josua Schmid <josua.schmid@renuo.ch> | 2019-03-26 13:53:41 +0100 |
commit | 25f2e0c39da2b9c61db75df2d767ee9c10d583b8 (patch) | |
tree | b87fef53330be34a1ddd271af5e0ea2d49a42ba7 /actionpack/test | |
parent | 08a435fa8c2307e78436eeaad43bfae7a54b2ab4 (diff) | |
download | rails-25f2e0c39da2b9c61db75df2d767ee9c10d583b8.tar.gz rails-25f2e0c39da2b9c61db75df2d767ee9c10d583b8.tar.bz2 rails-25f2e0c39da2b9c61db75df2d767ee9c10d583b8.zip |
Raise if resource custom params contain colons
After this change it's not possible anymore to configure routes
like this:
routes.draw do
resources :users, param: "name/:sneaky"
end
Fixes #30467.
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 897d17885e..7b763ec2bd 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -3338,6 +3338,16 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest assert_equal "0c0c0b68-d24b-11e1-a861-001ff3fffe6f", @request.params[:download] end + def test_colon_containing_custom_param + ex = assert_raises(ArgumentError) { + draw do + resources :profiles, param: "username/:is_admin" + end + } + + assert_match(/:param option can't contain colon/, ex.message) + end + def test_action_from_path_is_not_frozen draw do get "search" => "search" |