test/test_sanitize.rb in sanitize-3.1.0 vs test/test_sanitize.rb in sanitize-3.1.1

- old
+ new

@@ -20,10 +20,14 @@ it 'should not modify the input string' do input = '<!DOCTYPE html><b>foo</b>' @s.document(input) input.must_equal('<!DOCTYPE html><b>foo</b>') end + + it 'should not choke on frozen documents' do + @s.document('<!doctype html><html><b>foo</b>'.freeze).must_equal "<html>foo</html>\n" + end end describe '#fragment' do it 'should sanitize an HTML fragment' do @s.fragment('<b>Lo<!-- comment -->rem</b> <a href="pants" title="foo">ipsum</a> <a href="http://foo.com/"><strong>dolor</strong></a> sit<br/>amet <script>alert("hello world");</script>') @@ -39,9 +43,13 @@ it 'should not choke on fragments containing <html> or <body>' do @s.fragment('<html><b>foo</b></html>').must_equal 'foo' @s.fragment('<body><b>foo</b></body>').must_equal 'foo' @s.fragment('<html><body><b>foo</b></body></html>').must_equal 'foo' @s.fragment('<!DOCTYPE html><html><body><b>foo</b></body></html>').must_equal 'foo' + end + + it 'should not choke on frozen fragments' do + @s.fragment('<b>foo</b>'.freeze).must_equal 'foo' end end describe '#node!' do it 'should sanitize a Nokogiri::XML::Node' do