diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-01-07 05:13:07 -0200 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2016-01-07 05:13:07 -0200 |
commit | 21dd85f1ee0fb26007e5773226de3df07cbcfe39 (patch) | |
tree | c885552f696bb37db39ad1378d5cac4d78486e3d /actionpack/test/dispatch | |
parent | 2674f8043ff610769d12eccd6ac9902345c336b7 (diff) | |
parent | a31078556a82ded9cb13c71727e146bb716a17ec (diff) | |
download | rails-21dd85f1ee0fb26007e5773226de3df07cbcfe39.tar.gz rails-21dd85f1ee0fb26007e5773226de3df07cbcfe39.tar.bz2 rails-21dd85f1ee0fb26007e5773226de3df07cbcfe39.zip |
Merge pull request #22903 from prathamesh-sonpatki/allow-ac-parameters-hash-as-an-argument-to-routes
Allow AC::Parameters as an argument to url_helpers
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 82222a141c..62d65ec5c0 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -3578,6 +3578,27 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest assert_equal 'HEAD', @response.body end + def test_passing_action_parameters_to_url_helpers_raises_error_if_parameters_are_not_permitted + draw do + root :to => 'projects#index' + end + params = ActionController::Parameters.new(id: '1') + + assert_raises ArgumentError do + root_path(params) + end + end + + def test_passing_action_parameters_to_url_helpers_is_allowed_if_parameters_are_permitted + draw do + root :to => 'projects#index' + end + params = ActionController::Parameters.new(id: '1') + params.permit! + + assert_equal '/?id=1', root_path(params) + end + private def draw(&block) |