Sha256: 4078a851fa604c2b81bed3eae20261764e24520d7a5d5a96171bb85f4d87c1d6
Contents?: true
Size: 1.56 KB
Versions: 2
Compression:
Stored size: 1.56 KB
Contents
class Nanoc::Checking::Checks::HTMLTest < Nanoc::TestCase def test_run_ok require 'w3c_validators' if ::W3CValidators::VERSION =~ /\A1\.3|1\.3\.1\z/ skip 'broken (see https://github.com/w3c-validators/w3c_validators/issues/25)' end VCR.use_cassette('html_run_ok') do 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::Checking::Checks::HTML.create(site) check.run # Check assert check.issues.empty? end end end def test_run_error VCR.use_cassette('html_run_error') do 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::Checking::Checks::HTML.create(site) check.run # Check refute check.issues.empty? assert_equal 2, check.issues.size assert_equal 'line 1: no document type declaration; will parse without validation: <h2>Hi!</h1>', check.issues.to_a[0].description assert_equal 'line 1: end tag for element "H1" which is not open: <h2>Hi!</h1>', check.issues.to_a[1].description end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nanoc-4.4.5 | test/checking/checks/test_html.rb |
nanoc-4.4.4 | test/checking/checks/test_html.rb |