diff --git a/test/integration/test_ad_hoc.rb b/test/integration/test_ad_hoc.rb index 42926363..4d5f0cbc 100644 --- a/test/integration/test_ad_hoc.rb +++ b/test/integration/test_ad_hoc.rb @@ -222,38 +222,40 @@ def test_dont_remove_whitespace_between_tags # context "comments outside html" do context "bare comments" do - HTML = "" + let(:html) { "" } it "Loofah.document removes the comment" do - sanitized = Loofah.document(HTML) + sanitized = Loofah.document(html) sanitized_html = sanitized.to_html refute_match(/--/, sanitized_html) end it "Loofah.scrub_document removes the comment" do - sanitized = Loofah.scrub_document(HTML, :prune) + sanitized = Loofah.scrub_document(html, :prune) sanitized_html = sanitized.to_html refute_match(/--/, sanitized_html) end end context "doc with comments outside HTML" do - HTML = <<~EOF - - - -
hello - EOF + let(:html) do + <<~EOF + + + +
hello + EOF + end it "Loofah.document removes the comment" do - sanitized = Loofah.document(HTML) + sanitized = Loofah.document(html) sanitized_html = sanitized.to_html refute_match(/--/, sanitized_html) end it "Loofah.scrub_document removes the comment" do - sanitized = Loofah.scrub_document(HTML, :prune) + sanitized = Loofah.scrub_document(html, :prune) sanitized_html = sanitized.to_html refute_match(/--/, sanitized_html) end