Skip to content

Commit 5b73a09

Browse files
authored
Merge pull request #90 from JuanitoFatas/jf.fix-tests
Fix build
2 parents 7d30b71 + 3ca8a87 commit 5b73a09

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

test/sanitizer_test.rb

+12-4
Original file line numberDiff line numberDiff line change
@@ -485,35 +485,43 @@ def test_allow_data_attribute_if_requested
485485
end
486486

487487
def test_uri_escaping_of_href_attr_in_a_tag_in_white_list_sanitizer
488+
skip if RUBY_VERSION < "2.3"
489+
488490
html = %{<a href='examp<!--" unsafeattr=foo()>-->le.com'>test</a>}
489491

490492
text = white_list_sanitize(html)
491493

492-
assert_equal %{<a href="https://github.com/examp%3Cspan%20class="x x-first x-last"><!--%22%20unsafeattr=foo()>-->le.com">test</a>}, text
494+
assert_equal %{<a href=\"examp&lt;!--%22%20unsafeattr=foo()&gt;--&gt;le.com\">test</a>}, text
493495
end
494496

495497
def test_uri_escaping_of_src_attr_in_a_tag_in_white_list_sanitizer
498+
skip if RUBY_VERSION < "2.3"
499+
496500
html = %{<a src='examp<!--" unsafeattr=foo()>-->le.com'>test</a>}
497501

498502
text = white_list_sanitize(html)
499503

500-
assert_equal %{<a src="https://github.com/examp%3Cspan%20class="x x-first x-last"><!--%22%20unsafeattr=foo()>-->le.com">test</a>}, text
504+
assert_equal %{<a src=\"examp&lt;!--%22%20unsafeattr=foo()&gt;--&gt;le.com\">test</a>}, text
501505
end
502506

503507
def test_uri_escaping_of_name_attr_in_a_tag_in_white_list_sanitizer
508+
skip if RUBY_VERSION < "2.3"
509+
504510
html = %{<a name='examp<!--" unsafeattr=foo()>-->le.com'>test</a>}
505511

506512
text = white_list_sanitize(html)
507513

508-
assert_equal %{<a name="examp<!--%22%20unsafeattr=foo()>-->le.com">test</a>}, text
514+
assert_equal %{<a name=\"examp&lt;!--%22%20unsafeattr=foo()&gt;--&gt;le.com\">test</a>}, text
509515
end
510516

511517
def test_uri_escaping_of_name_action_in_a_tag_in_white_list_sanitizer
518+
skip if RUBY_VERSION < "2.3"
519+
512520
html = %{<a action='examp<!--" unsafeattr=foo()>-->le.com'>test</a>}
513521

514522
text = white_list_sanitize(html, attributes: ['action'])
515523

516-
assert_equal %{<a action="https://github.com/examp%3Cspan%20class="x x-first x-last"><!--%22%20unsafeattr=foo()>-->le.com">test</a>}, text
524+
assert_equal %{<a action=\"examp&lt;!--%22%20unsafeattr=foo()&gt;--&gt;le.com\">test</a>}, text
517525
end
518526

519527
protected

0 commit comments

Comments
 (0)