diff options
author | Xavier Noria <fxn@hashref.com> | 2010-06-29 19:55:57 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-06-30 00:23:13 +0200 |
commit | cba1460a2fe2bbe1153620582a66e03cec9ba7a5 (patch) | |
tree | 5127a168612f8c18ab8edd1e30e669aea0f1cea7 /actionpack/test/template | |
parent | 0253bf425ea6fc112d8eecc6e7ea94e349cb538d (diff) | |
download | rails-cba1460a2fe2bbe1153620582a66e03cec9ba7a5.tar.gz rails-cba1460a2fe2bbe1153620582a66e03cec9ba7a5.tar.bz2 rails-cba1460a2fe2bbe1153620582a66e03cec9ba7a5.zip |
url_for no longer escapes HTML, the :escape option is also gone
Rationale: url_for is just a path/URL generator, it is the responsability of the caller to escape conveniently HTML needs it, JavaScript needs different escaping, a text mail needs no escaping at all, etc.
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/url_helper_test.rb | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index 897228677b..035f501f03 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -40,20 +40,8 @@ class UrlHelperTest < ActiveSupport::TestCase end alias url_hash hash_for - def test_url_for_escapes_urls - assert_equal "/?a=b&c=d", url_for(abcd) - assert_equal "/?a=b&c=d", url_for(abcd(:escape => true)) - assert_equal "/?a=b&c=d", url_for(abcd(:escape => false)) - end - - def test_url_for_escaping_is_safety_aware - assert url_for(abcd(:escape => true)).html_safe?, "escaped urls should be html_safe?" - assert !url_for(abcd(:escape => false)).html_safe?, "non-escaped urls should not be html_safe?" - end - - def test_url_for_escapes_url_once - assert_equal "/?a=b&c=d", url_for("/?a=b&c=d") - assert_equal "/?a=b&c=d", url_for(abcd) + def test_url_for_does_not_escape_urls + assert_equal "/?a=b&c=d", url_for(abcd) end def test_url_for_with_back @@ -151,7 +139,7 @@ class UrlHelperTest < ActiveSupport::TestCase end def test_link_tag_with_query_and_no_name - link = link_to(nil, "http://www.example.com?q1=v1&q2=v2") + link = link_to(nil, "http://www.example.com?q1=v1&q2=v2") expected = %{<a href="http://www.example.com?q1=v1&q2=v2">http://www.example.com?q1=v1&q2=v2</a>} assert_dom_equal expected, link end @@ -308,7 +296,7 @@ class UrlHelperTest < ActiveSupport::TestCase @request = request_for_url("/?order=desc&page=1") assert current_page?(hash_for(:order => "desc", :page => "1")) - assert current_page?("http://www.example.com/?order=desc&page=1") + assert current_page?("http://www.example.com/?order=desc&page=1") end def test_link_unless_current |