Browse files

button_to should generate an html_safe string

Signed-off-by: Michael Koziarski <michael@koziarski.com>
  • Loading branch information...
1 parent c0137f6 commit 26f2cce232d5455231255fcc908a343c03f7929c @nono nono committed with NZKoz Mar 8, 2010
Showing with 6 additions and 2 deletions.
  1. +2 −2 actionpack/lib/action_view/helpers/url_helper.rb
  2. +4 −0 actionpack/test/template/url_helper_test.rb
View
4 actionpack/lib/action_view/helpers/url_helper.rb
@@ -308,8 +308,8 @@ def button_to(name, options = {}, html_options = {})
html_options.merge!("type" => "submit", "value" => name)
- "<form method=\"#{form_method}\" action=\"#{escape_once url}\" class=\"button-to\"><div>" +
- method_tag + tag("input", html_options) + request_token_tag + "</div></form>".html_safe
+ ("<form method=\"#{form_method}\" action=\"#{escape_once url}\" class=\"button-to\"><div>" +
+ method_tag + tag("input", html_options) + request_token_tag + "</div></form>").html_safe
end
View
4 actionpack/test/template/url_helper_test.rb
@@ -88,6 +88,10 @@ def test_button_to_with_method_get
)
end
+ def test_button_to_returns_an_html_safe_string
+ assert button_to("Hello", "http://www.example.com").html_safe?
+ end
+
def test_link_tag_with_straight_url
assert_dom_equal "<a href=\"http://www.example.com\">Hello</a>", link_to("Hello", "http://www.example.com")
end

0 comments on commit 26f2cce

Please sign in to comment.