Sha256: 269ca888e963eadb782ae1a6afb47ad84445eac81313b8d5f2495b50ab8cdf53

Contents?: true

Size: 1.03 KB

Versions: 15

Compression:

Stored size: 1.03 KB

Contents

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

require 'webgen/test_helper'
require 'webgen/content_processor/tidy'

class TestTidy < Minitest::Test

  include Webgen::TestHelper

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

    setup_context
    @website.config['content_processor.tidy.options'] = ''
    cp = Webgen::ContentProcessor::Tidy

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

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

    @context.content = "testcontent"
    assert_match(/html.*testcontent/im, cp.call(@context).content)
    assert_log_match(/inserting missing/)

    @context.content = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"><html><head><title>t</title></head><body>b</body></html'
    assert_match(/body.*b.*body/im, 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_tidy.rb
webgen-1.7.2 test/webgen/content_processor/test_tidy.rb
webgen-1.7.1 test/webgen/content_processor/test_tidy.rb
webgen-1.7.0 test/webgen/content_processor/test_tidy.rb
webgen-1.6.0 test/webgen/content_processor/test_tidy.rb
webgen-1.5.2 test/webgen/content_processor/test_tidy.rb
webgen-1.5.1 test/webgen/content_processor/test_tidy.rb
webgen-1.5.0 test/webgen/content_processor/test_tidy.rb
webgen-1.4.1 test/webgen/content_processor/test_tidy.rb
webgen-1.4.0 test/webgen/content_processor/test_tidy.rb
webgen-1.3.0 test/webgen/content_processor/test_tidy.rb
webgen-1.2.1 test/webgen/content_processor/test_tidy.rb
webgen-1.2.0 test/webgen/content_processor/test_tidy.rb
webgen-1.1.0 test/webgen/content_processor/test_tidy.rb
webgen-1.0.0 test/webgen/content_processor/test_tidy.rb