Sha256: 1d96dcf9f783bf7d8e37b3ef0112d88ca346972dfce21ebe327cabaf958df608

Contents?: true

Size: 1.09 KB

Versions: 15

Compression:

Stored size: 1.09 KB

Contents

# -*- encoding: utf-8 -*-

require 'webgen/test_helper'

class TestXmllint < Minitest::Test

  include Webgen::TestHelper

  def test_static_call
    require 'webgen/content_processor/xmllint' rescue skip($!.message)

    setup_context
    @website.config['content_processor.xmllint.options'] = ''
    cp = Webgen::ContentProcessor::Xmllint

    begin
      cp.call(@context)
    rescue Webgen::CommandNotFoundError
      skip("Binary xmllint not found")
    end

    begin
      tmp, ENV['PATH'] = ENV['PATH'], '/sbin'
      assert_raises(Webgen::CommandNotFoundError) { cp.call(@context) }
    ensure
      ENV['PATH'] = tmp
    end

    @context.content = data = 'test'
    assert_equal(data, cp.call(@context).content)
    assert_log_match(/<\/test:~1>/)

    @context.content = data = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' +
      '<html xmlns="http://www.w3.org/1999/xhtml"><head><title>title</title></head><body></body></html>'
    assert_equal(data, cp.call(@context).content)
    assert_equal(0, @logio.string.length)
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
webgen-1.7.3 test/webgen/content_processor/test_xmllint.rb
webgen-1.7.2 test/webgen/content_processor/test_xmllint.rb
webgen-1.7.1 test/webgen/content_processor/test_xmllint.rb
webgen-1.7.0 test/webgen/content_processor/test_xmllint.rb
webgen-1.6.0 test/webgen/content_processor/test_xmllint.rb
webgen-1.5.2 test/webgen/content_processor/test_xmllint.rb
webgen-1.5.1 test/webgen/content_processor/test_xmllint.rb
webgen-1.5.0 test/webgen/content_processor/test_xmllint.rb
webgen-1.4.1 test/webgen/content_processor/test_xmllint.rb
webgen-1.4.0 test/webgen/content_processor/test_xmllint.rb
webgen-1.3.0 test/webgen/content_processor/test_xmllint.rb
webgen-1.2.1 test/webgen/content_processor/test_xmllint.rb
webgen-1.2.0 test/webgen/content_processor/test_xmllint.rb
webgen-1.1.0 test/webgen/content_processor/test_xmllint.rb
webgen-1.0.0 test/webgen/content_processor/test_xmllint.rb