Sha256: 203dd6350bdb99018cc85076d3286aa0320b56558f0e9480a6e748151d68e65c
Contents?: true
Size: 1.25 KB
Versions: 12
Compression:
Stored size: 1.25 KB
Contents
# encoding: utf-8 class Nanoc::Extra::Validators::W3CTest < MiniTest::Unit::TestCase include Nanoc::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 = Nanoc::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 = Nanoc::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
12 entries across 12 versions & 1 rubygems