diff --git a/test/integration/test_ad_hoc.rb b/test/integration/test_ad_hoc.rb
index 16bffc32..be4583fb 100644
--- a/test/integration/test_ad_hoc.rb
+++ b/test/integration/test_ad_hoc.rb
@@ -16,66 +16,67 @@ class IntegrationTestAdHoc < Loofah::TestCase
end
end
- def test_removal_of_illegal_tag
- html = <<-HTML
+ context "tests" do
+ def test_removal_of_illegal_tag
+ html = <<-HTML
following this there should be no jim tag
jim
was there?
HTML
- sane = Nokogiri::HTML(Loofah.scrub_fragment(html, :escape).to_xml)
- assert sane.xpath("//jim").empty?
- end
+ sane = Nokogiri::HTML(Loofah.scrub_fragment(html, :escape).to_xml)
+ assert sane.xpath("//jim").empty?
+ end
- def test_removal_of_illegal_attribute
- html = "
"
- sane = Nokogiri::HTML(Loofah.scrub_fragment(html, :escape).to_xml)
- node = sane.xpath("//p").first
- assert node.attributes['class']
- assert node.attributes['abbr']
- assert_nil node.attributes['foo']
- end
+ def test_removal_of_illegal_attribute
+ html = ""
+ sane = Nokogiri::HTML(Loofah.scrub_fragment(html, :escape).to_xml)
+ node = sane.xpath("//p").first
+ assert node.attributes['class']
+ assert node.attributes['abbr']
+ assert_nil node.attributes['foo']
+ end
- def test_removal_of_illegal_url_in_href
- html = <<-HTML
+ def test_removal_of_illegal_url_in_href
+ html = <<-HTML
this link should have its href removed because of illegal urlthis link should be fine
HTML
- sane = Nokogiri::HTML(Loofah.scrub_fragment(html, :escape).to_xml)
- nodes = sane.xpath("//a")
- assert_nil nodes.first.attributes['href']
- assert nodes.last.attributes['href']
- end
+ sane = Nokogiri::HTML(Loofah.scrub_fragment(html, :escape).to_xml)
+ nodes = sane.xpath("//a")
+ assert_nil nodes.first.attributes['href']
+ assert nodes.last.attributes['href']
+ end
- def test_css_sanitization
- html = ""
- sane = Nokogiri::HTML(Loofah.scrub_fragment(html, :escape).to_xml)
- assert_match %r/#000/, sane.inner_html
- refute_match %r/foo\.com/, sane.inner_html
- end
+ def test_css_sanitization
+ html = ""
+ sane = Nokogiri::HTML(Loofah.scrub_fragment(html, :escape).to_xml)
+ assert_match %r/#000/, sane.inner_html
+ refute_match %r/foo\.com/, sane.inner_html
+ end
- def test_fragment_with_no_tags
- assert_equal "This fragment has no tags.", Loofah.scrub_fragment("This fragment has no tags.", :escape).to_xml
- end
+ def test_fragment_with_no_tags
+ assert_equal "This fragment has no tags.", Loofah.scrub_fragment("This fragment has no tags.", :escape).to_xml
+ end
- def test_fragment_in_p_tag
- assert_equal "
This fragment is in a p.
", Loofah.scrub_fragment("
This fragment is in a p.
", :escape).to_xml
- end
+ def test_fragment_in_p_tag
+ assert_equal "
This fragment is in a p.
", Loofah.scrub_fragment("
This fragment is in a p.
", :escape).to_xml
+ end
- def test_fragment_in_p_tag_plus_stuff
- assert_equal "
This fragment is in a p.
foobar", Loofah.scrub_fragment("
This fragment is in a p.
foobar", :escape).to_xml
- end
+ def test_fragment_in_p_tag_plus_stuff
+ assert_equal "
This fragment is in a p.
foobar", Loofah.scrub_fragment("
This fragment is in a p.
foobar", :escape).to_xml
+ end
- def test_fragment_with_text_nodes_leading_and_trailing
- assert_equal "text
fragment
text", Loofah.scrub_fragment("text
fragment
text", :escape).to_xml
- end
+ def test_fragment_with_text_nodes_leading_and_trailing
+ assert_equal "text
fragment
text", Loofah.scrub_fragment("text
fragment
text", :escape).to_xml
+ end
- def test_whitewash_on_fragment
- html = "safe description"
- whitewashed = Loofah.scrub_document(html, :whitewash).xpath("/html/body/*").to_s
- assert_equal "
safe
description", whitewashed.gsub("\n","")
- end
+ def test_whitewash_on_fragment
+ html = "safe description"
+ whitewashed = Loofah.scrub_document(html, :whitewash).xpath("/html/body/*").to_s
+ assert_equal "