aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorArthur Nogueira Neves <github@arthurnn.com>2015-11-26 16:10:46 -0500
committerArthur Nogueira Neves <github@arthurnn.com>2015-11-26 16:10:46 -0500
commit9afb0b9c432f6987a59b44c2fff15785b5fd5784 (patch)
tree91c94f15998f1038ad8637eab23b5dd434c5a44a /actionview
parent52141d365805f6433c9adf272aa6c19e3049147e (diff)
parente6e056c2c141ec94eb8e79a30ee766f77fdaf30d (diff)
downloadrails-9afb0b9c432f6987a59b44c2fff15785b5fd5784.tar.gz
rails-9afb0b9c432f6987a59b44c2fff15785b5fd5784.tar.bz2
rails-9afb0b9c432f6987a59b44c2fff15785b5fd5784.zip
Merge pull request #21241 from pdg137/master
In url_for, never append ? when the query string is empty anyway.
Diffstat (limited to 'actionview')
-rw-r--r--actionview/test/template/url_helper_test.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/actionview/test/template/url_helper_test.rb b/actionview/test/template/url_helper_test.rb
index 48d0a9a47a..62fa75bc63 100644
--- a/actionview/test/template/url_helper_test.rb
+++ b/actionview/test/template/url_helper_test.rb
@@ -38,6 +38,10 @@ class UrlHelperTest < ActiveSupport::TestCase
assert_equal "/?a=b&c=d", url_for(hash_for(a: :b, c: :d))
end
+ def test_url_for_does_not_include_empty_hashes
+ assert_equal "/", url_for(hash_for(a: {}))
+ end
+
def test_url_for_with_back
referer = 'http://www.example.com/referer'
@controller = Struct.new(:request).new(Struct.new(:env).new("HTTP_REFERER" => referer))