diff --git a/test/url_for_test.rb b/test/url_for_test.rb
new file mode 100644
index 0000000..b13451b
--- /dev/null
+++ b/test/url_for_test.rb
@@ -0,0 +1,39 @@
+require 'test_helper'
+
+class UrlHelperTest < ActionView::TestCase
+
+ def abcd(hash = {})
+ hash_for(:a => :b, :c => :d).merge(hash)
+ end
+
+ def hash_for(opts = {})
+ {:controller => "foo", :action => "bar"}.merge(opts)
+ end
+
+ def test_url_for_does_not_escape_urls_if_explicitly_stated
+ assert_equal "/foo/bar?a=b&c=d", url_for(abcd(:escape => false))
+ end
+
+ def test_link_tag_with_img
+ link = link_to("".html_safe, "/")
+ expected = %{
}
+ assert_dom_equal expected, link
+ end
+
+ def test_link_to_should_not_escape_content_for_html_safe
+ link = link_to("Some
html
".html_safe, "/") + expected = %{Somehtml
} + assert_dom_equal link, expected + end + + def test_link_to_escapes_content_for_non_safe + link = link_to("Somehtml
", "/") + expected = %{Some <p>html</p>} + assert_dom_equal link, expected + 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 +end