Sha256: 2ef9107b7397e40e8c872df22e3862fee9f9e88846d3e0b3320261937c6d9335

Contents?: true

Size: 739 Bytes

Versions: 5

Compression:

Stored size: 739 Bytes

Contents

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

class TestHelpers < Test::Unit::TestCase

  HTML_STRING = "<div>omgwtfbbq</div>"

  context "#strip_tags" do
    should "invoke Loofah.fragment.text" do
      mock_doc = mock
      Loofah.expects(:fragment).with(HTML_STRING).returns(mock_doc)
      mock_doc.expects(:text)

      Loofah::Helpers.strip_tags HTML_STRING
    end
  end

  context "#sanitize" do
    should "invoke Loofah.scrub_fragment(:strip).to_s" do
      mock_doc = mock
      Loofah.expects(:fragment).with(HTML_STRING).returns(mock_doc)
      mock_doc.expects(:scrub!).with(:strip).returns(mock_doc)
      mock_doc.expects(:to_s)

      Loofah::Helpers.sanitize HTML_STRING
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
loofah-1.0.0 test/unit/test_helpers.rb
loofah-1.0.0.beta.1 test/unit/test_helpers.rb
loofah-0.4.7 test/unit/test_helpers.rb
loofah-0.4.6 test/unit/test_helpers.rb
loofah-0.4.5 test/unit/test_helpers.rb