Skip to content

Commit

Permalink
Make tests pass again with recent nokogiri versions
Browse files Browse the repository at this point in the history
  • Loading branch information
fschwahn committed May 5, 2017
1 parent 267b121 commit 2e8a706
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/sanitizer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ def test_strip_tags_with_quote
end

def test_strip_invalid_html
assert_equal "", full_sanitize("<<<bad html")
assert_equal "&lt;&lt;", full_sanitize("<<<bad html")
end

def test_strip_nested_tags
expected = "Weia onclick='alert(document.cookie);'/&gt;rdos"
expected = "Wei&lt;a onclick='alert(document.cookie);'/&gt;rdos"
input = "Wei<<a>a onclick='alert(document.cookie);'</a>/>rdos"
assert_equal expected, full_sanitize(input)
end
Expand Down Expand Up @@ -98,8 +98,8 @@ def test_strip_tags_with_tags
assert_equal "This is a test.", full_sanitize("<p>This <u>is<u> a <a href='test.html'><strong>test</strong></a>.</p>")
end

def test_strip_tags_with_many_open_quotes
assert_equal "", full_sanitize("<<<bad html>")
def test_escape_tags_with_many_open_quotes
assert_equal "&lt;&lt;", full_sanitize("<<<bad html>")
end

def test_strip_tags_with_sentence
Expand All @@ -123,7 +123,7 @@ def test_full_sanitize_respect_html_escaping_of_the_given_string
end

def test_strip_links_with_tags_in_tags
expected = "a href='hello'&gt;all <b>day</b> long/a&gt;"
expected = "&lt;a href='hello'&gt;all <b>day</b> long&lt;/a&gt;"
input = "<<a>a href='hello'>all <b>day</b> long<</A>/a>"
assert_equal expected, link_sanitize(input)
end
Expand Down Expand Up @@ -360,7 +360,7 @@ def test_should_sanitize_invalid_script_tag
end

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

Expand Down

0 comments on commit 2e8a706

Please sign in to comment.