diff options
-rw-r--r-- | actionpack/lib/action_view/helpers/url_helper.rb | 6 | ||||
-rw-r--r-- | actionpack/test/template/url_helper_test.rb | 8 |
2 files changed, 10 insertions, 4 deletions
diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index a1468b6e90..bfe11fc1d7 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -425,8 +425,8 @@ module ActionView # * <tt>:bcc</tt> - Blind Carbon Copy additional recipients on the email. # # ==== Obfuscation - # Prior to Rails 4.0, +mail_to+ provided options for encoding the address - # in order to hinder email harvesters. To take advantage of these options, + # Prior to Rails 4.0, +mail_to+ provided options for encoding the address + # in order to hinder email harvesters. To take advantage of these options, # install the +actionview-encoded_mail_to+ gem. # # ==== Examples @@ -451,7 +451,7 @@ module ActionView def mail_to(email_address, name = nil, html_options = {}, &block) html_options, name = name, nil if block_given? html_options ||= {} - html_options.stringify_keys! + html_options = html_options.stringify_keys email_address = ERB::Util.html_escape(email_address) diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index e7b04d40c0..9b4c419807 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -543,11 +543,17 @@ class UrlHelperTest < ActiveSupport::TestCase mail_to('me@example.com') { content_tag(:span, 'Email me') } end - def test_link_tag_with_block_and_options + def test_mail_to_with_block_and_options assert_dom_equal %{<a class="special" href="mailto:me@example.com?cc=ccaddress%40example.com"><span>Email me</span></a>}, mail_to('me@example.com', cc: "ccaddress@example.com", class: "special") { content_tag(:span, 'Email me') } end + def test_mail_to_does_not_modify_html_options_hash + options = { class: 'special' } + mail_to 'me@example.com', 'ME!', options + assert_equal({ class: 'special' }, options) + end + def protect_against_forgery? self.request_forgery end |