Sha256: bf164d7f1a6013c00eaf0d33812fb4367a5e8ab0c065de50fdfe681cff5e36b4

Contents?: true

Size: 860 Bytes

Versions: 3

Compression:

Stored size: 860 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))

class TestStripTags < Test::Unit::TestCase

  def test_nil
    assert_nil Dryopteris.strip_tags(nil)
  end
  
  def test_empty_string
    assert_equal Dryopteris.strip_tags(""), ""
  end
  
  def test_return_empty_string_when_nothing_left
    assert_equal "", Dryopteris.strip_tags('<script>test</script>')
  end
  
  def test_removal_of_all_tags
    html = <<-HTML
      What's up <strong>doc</strong>?
    HTML
    stripped = Dryopteris.strip_tags(html)
    assert_equal "What's up doc?".strip, stripped.strip
  end
  
  def test_dont_remove_whitespace
    html = "Foo\nBar"
    assert_equal html, Dryopteris.strip_tags(html)
  end
  
  def test_dont_remove_whitespace_between_tags
    html = "<p>Foo</p>\n<p>Bar</p>"
    assert_equal "Foo\nBar", Dryopteris.strip_tags(html)
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mdalessio-dryopteris-0.1.0 test/test_strip_tags.rb
mdalessio-dryopteris-0.1.1 test/test_strip_tags.rb
mdalessio-dryopteris-0.1.2 test/test_strip_tags.rb