Skip to content

Commit 2e8a706

Browse files
committed
Make tests pass again with recent nokogiri versions
1 parent 267b121 commit 2e8a706

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/sanitizer_test.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ def test_strip_tags_with_quote
5858
end
5959

6060
def test_strip_invalid_html
61-
assert_equal "", full_sanitize("<<<bad html")
61+
assert_equal "&lt;&lt;", full_sanitize("<<<bad html")
6262
end
6363

6464
def test_strip_nested_tags
65-
expected = "Weia onclick='alert(document.cookie);'/&gt;rdos"
65+
expected = "Wei&lt;a onclick='alert(document.cookie);'/&gt;rdos"
6666
input = "Wei<<a>a onclick='alert(document.cookie);'</a>/>rdos"
6767
assert_equal expected, full_sanitize(input)
6868
end
@@ -98,8 +98,8 @@ def test_strip_tags_with_tags
9898
assert_equal "This is a test.", full_sanitize("<p>This <u>is<u> a <a href='test.html'><strong>test</strong></a>.</p>")
9999
end
100100

101-
def test_strip_tags_with_many_open_quotes
102-
assert_equal "", full_sanitize("<<<bad html>")
101+
def test_escape_tags_with_many_open_quotes
102+
assert_equal "&lt;&lt;", full_sanitize("<<<bad html>")
103103
end
104104

105105
def test_strip_tags_with_sentence
@@ -123,7 +123,7 @@ def test_full_sanitize_respect_html_escaping_of_the_given_string
123123
end
124124

125125
def test_strip_links_with_tags_in_tags
126-
expected = "a href='hello'&gt;all <b>day</b> long/a&gt;"
126+
expected = "&lt;a href='hello'&gt;all <b>day</b> long&lt;/a&gt;"
127127
input = "<<a>a href='hello'>all <b>day</b> long<</A>/a>"
128128
assert_equal expected, link_sanitize(input)
129129
end
@@ -360,7 +360,7 @@ def test_should_sanitize_invalid_script_tag
360360
end
361361

362362
def test_should_sanitize_script_tag_with_multiple_open_brackets
363-
assert_sanitized %(<<SCRIPT>alert("XSS");//<</SCRIPT>), "alert(\"XSS\");//"
363+
assert_sanitized %(<<SCRIPT>alert("XSS");//<</SCRIPT>), "&lt;alert(\"XSS\");//&lt;"
364364
assert_sanitized %(<iframe src=http://ha.ckers.org/scriptlet.html\n<a), ""
365365
end
366366

0 commit comments

Comments
 (0)