Sha256: c4dde804434d58637d51d9452b94144c6f66110e08215b7e81cad4c2194c0a19

Contents?: true

Size: 709 Bytes

Versions: 13

Compression:

Stored size: 709 Bytes

Contents

require "test_helper"

class HTML::Pipeline::PlainTextInputFilterTest < Minitest::Test
  PlainTextInputFilter = HTML::Pipeline::PlainTextInputFilter

  def test_fails_when_given_a_documentfragment
    body = "<p>heyo</p>"
    doc  = Nokogiri::HTML::DocumentFragment.parse(body)
    assert_raises(TypeError) { PlainTextInputFilter.call(doc, {}) }
  end

  def test_wraps_input_in_a_div_element
    doc = PlainTextInputFilter.call("howdy pahtner", {})
    assert_equal "<div>howdy pahtner</div>", doc.to_s
  end

  def test_html_escapes_plain_text_input
    doc = PlainTextInputFilter.call("See: <http://example.org>", {})
    assert_equal "<div>See: &lt;http://example.org&gt;</div>",
      doc.to_s
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
html-pipeline-2.4.1 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-2.4.0 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-2.3.0 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-2.2.4 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-2.2.3 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-2.2.2 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-2.2.1 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-2.2.0 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-2.1.0 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-2.0 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-1.11.0 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-1.10.0 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-1.9.0 test/html/pipeline/plain_text_input_filter_test.rb