Sha256: 43c77b156196beb038311b69e094aee20b5e140b797e3e1394623c1eb6ca4971

Contents?: true

Size: 988 Bytes

Versions: 1

Compression:

Stored size: 988 Bytes

Contents

# encoding: utf-8

class Nanoc::Extra::Checking::Checks::HTMLTest < Nanoc::TestCase

  def test_run_ok
    with_site do |site|
      # Create files
      FileUtils.mkdir_p('output')
      File.open('output/blah.html', 'w') { |io| io.write('<!DOCTYPE html><html><head><title>Hello</title></head><body><h1>Hi!</h1></body>') }
      File.open('output/style.css', 'w') { |io| io.write('h1 { coxlor: rxed; }') }

      # Run check
      check = Nanoc::Extra::Checking::Checks::HTML.new(site)
      check.run

      # Check
      assert check.issues.empty?
    end
  end

  def test_run_error
    with_site do |site|
      # Create files
      FileUtils.mkdir_p('output')
      File.open('output/blah.html', 'w') { |io| io.write('<h2>Hi!</h1>') }
      File.open('output/style.css', 'w') { |io| io.write('h1 { coxlor: rxed; }') }

      # Run check
      check = Nanoc::Extra::Checking::Checks::HTML.new(site)
      check.run

      # Check
      refute check.issues.empty?
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nanoc-3.6.2 test/extra/checking/checks/test_html.rb