Sha256: be1e74441648232d36346eed59434482f44a1cd673955217bda00d81561dde85

Contents?: true

Size: 714 Bytes

Versions: 50

Compression:

Stored size: 714 Bytes

Contents

require "test_helper"

class HTML::Pipeline::PlainTextInputFilterTest < Test::Unit::TestCase
  PlainTextInputFilter = HTML::Pipeline::PlainTextInputFilter

  def test_fails_when_given_a_documentfragment
    body = "<p>heyo</p>"
    doc  = Nokogiri::HTML::DocumentFragment.parse(body)
    assert_raise(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

50 entries across 50 versions & 4 rubygems

Version Path
html-pipeline-linuxfr-0.14.23 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-linuxfr-0.14.22 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-linuxfr-0.14.21 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-linuxfr-0.14.20 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-1.8.0 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-linuxfr-0.14.19 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-linuxfr-0.14.18 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-linuxfr-0.14.17 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-linuxfr-0.14.16 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-1.7.0 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-linuxfr-0.14.15 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-linuxfr-0.14.14 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-linuxfr-0.14.13 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-1.6.0 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-1.5.0 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-1.4.0 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-linuxfr-0.14.12 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-1.3.0 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-linuxfr-0.14.11 test/html/pipeline/plain_text_input_filter_test.rb
html-pipeline-1.1.0 test/html/pipeline/plain_text_input_filter_test.rb