Sha256: 6eb558458c5d3315bfbd0c11627076be7675e1f06a336ed86095a75bf6355f54

Contents?: true

Size: 1010 Bytes

Versions: 7

Compression:

Stored size: 1010 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><meta charset="utf-8"><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

7 entries across 7 versions & 1 rubygems

Version Path
nanoc-3.6.9 test/extra/checking/checks/test_html.rb
nanoc-3.6.8 test/extra/checking/checks/test_html.rb
nanoc-3.6.7 test/extra/checking/checks/test_html.rb
nanoc-3.6.6 test/extra/checking/checks/test_html.rb
nanoc-3.6.5 test/extra/checking/checks/test_html.rb
nanoc-3.6.4 test/extra/checking/checks/test_html.rb
nanoc-3.6.3 test/extra/checking/checks/test_html.rb