aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-10-08 17:52:39 +0900
committerGitHub <noreply@github.com>2018-10-08 17:52:39 +0900
commitd4127a014c110faa9c4611244f01f4320616a49b (patch)
tree9e09409823eaaa91085a4b97e8e7995fcecb73ec /actionview/test
parent5dbf5c660ce4ad1f989f2d05032664c7ee26488c (diff)
parentb48c2ade09e9c43d6f7acee02d074a9d54323a70 (diff)
downloadrails-d4127a014c110faa9c4611244f01f4320616a49b.tar.gz
rails-d4127a014c110faa9c4611244f01f4320616a49b.tar.bz2
rails-d4127a014c110faa9c4611244f01f4320616a49b.zip
Merge pull request #33324 from Jcambass/fix-only-path-option-in-url-for-with-arrays
respect only_path option when an array is passed into url_for
Diffstat (limited to 'actionview/test')
-rw-r--r--actionview/test/template/url_helper_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/actionview/test/template/url_helper_test.rb b/actionview/test/template/url_helper_test.rb
index 6db9eb3be1..1ab28e4749 100644
--- a/actionview/test/template/url_helper_test.rb
+++ b/actionview/test/template/url_helper_test.rb
@@ -75,6 +75,15 @@ class UrlHelperTest < ActiveSupport::TestCase
assert_equal "javascript:history.back()", url_for(:back)
end
+ def test_url_for_with_array_defaults_to_only_path_true
+ assert_equal "/other", url_for([:other, { controller: "foo" }])
+ end
+
+ def test_url_for_with_array_and_only_path_set_to_false
+ default_url_options[:host] = "http://example.com"
+ assert_equal "http://example.com/other", url_for([:other, { controller: "foo", only_path: false }])
+ end
+
def test_to_form_params_with_hash
assert_equal(
[{ name: "name", value: "David" }, { name: "nationality", value: "Danish" }],