Sha256: 1fc7174aa4dd781285cf65606de1a77f0b9cfdb4e045d8e5cc99f96f2117650a
Contents?: true
Size: 1.28 KB
Versions: 3
Compression:
Stored size: 1.28 KB
Contents
# encoding: utf-8 require 'test/helper' class Nanoc3::Extra::Validators::W3CTest < MiniTest::Unit::TestCase include Nanoc3::TestHelpers def test_simple if_have 'w3c_validators' do # Create some sample files %w{ foo bar baz }.each do |filename| %w{ xxx yyy }.each do |extension| File.open("#{filename}.#{extension}", 'w') { |io| io.write("hello") } end end # Create validator w3c = Nanoc3::Extra::Validators::W3C.new('.', [ :xxx ]) # Configure expectations validator_result = mock validator_result.expects(:errors).times(3) validator = mock validator.expects(:validate_file).times(3).returns(validator_result) w3c.expects(:types_to_extensions).with([ :xxx ]).returns([ 'xxx' ]) w3c.expects(:validator_for).with('xxx').times(3).returns(validator) w3c.expects(:validation_started).times(3) w3c.expects(:validation_ended).times(3) # Run w3c.run end end def test_with_unknown_types if_have 'w3c_validators' do # Create validator w3c = Nanoc3::Extra::Validators::W3C.new('.', [ :foo ]) # Test exception = assert_raises RuntimeError do w3c.run end assert_equal 'unknown type: foo', exception.message end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nanoc3-3.1.9 | test/extra/validators/test_w3c.rb |
nanoc3-3.1.8 | test/extra/validators/test_w3c.rb |
nanoc3-3.2.0a4 | test/extra/validators/test_w3c.rb |