Skip to content

Commit

Permalink
added html checker test case
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdefreyne committed Oct 14, 2012
1 parent 86f228c commit dff1f40
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test/extra/checking/checkers/test_html.rb
@@ -0,0 +1,40 @@
# encoding: utf-8

class Nanoc::Extra::Checking::Checkers::HTMLTest < MiniTest::Unit::TestCase

include Nanoc::TestHelpers

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

# Run checker
checker = Nanoc::Extra::Checking::Checkers::HTML.new(site)
checker.run

# Check
assert checker.issues.empty?
end
end

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

# Run checker
checker = Nanoc::Extra::Checking::Checkers::HTML.new(site)
checker.run

# Check
refute checker.issues.empty?
end
end

end

0 comments on commit dff1f40

Please sign in to comment.