require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
class TestBasic < Test::Unit::TestCase
def test_nil
assert_nil Dryopteris.sanitize(nil)
end
def test_empty_string
assert_equal "", Dryopteris.sanitize("")
end
def test_removal_of_illegal_tag
html = <<-HTML
following this there should be no jim tag
This fragment is in a p.
", Dryopteris.sanitize("This fragment is in a p.
") end def test_fragment_in_a_nontrivial_p_tag assert_equal " \nThis fragment is in a p.
", Dryopteris.sanitize(" \nThis fragment is in a p.
") end def test_fragment_in_p_tag_plus_stuff assert_equal "This fragment is in a p.
foobar", Dryopteris.sanitize("This fragment is in a p.
foobar") end def test_fragment_with_text_nodes_leading_and_trailing assert_equal "textfragment
text", Dryopteris.sanitize("textfragment
text") end def test_whitewash_on_fragment html = "safe description" whitewashed = Dryopteris.whitewash_document(html) assert_equal "safe
description", whitewashed end end