Sha256: 8f9da0e78905aa3b505b8f8f05ef54ffc9d5384e198d75989f4b63e3f6d7b304

Contents?: true

Size: 926 Bytes

Versions: 2

Compression:

Stored size: 926 Bytes

Contents

# encoding: utf-8

class Nanoc::Extra::Validators::W3CTest < Nanoc::TestCase
  def test_simple
    if_have 'w3c_validators' do
      with_site do |_site|
        # Create some sample files
        %w(foo bar baz).each do |filename|
          %w(xxx yyy).each do |extension|
            File.open("output/#{filename}.#{extension}", 'w') { |io| io.write('hello') }
          end
        end

        # Create validator
        w3c = Nanoc::Extra::Validators::W3C.new('.', [:html])

        # Run
        w3c.run
      end
    end
  end

  def test_with_unknown_types
    if_have 'w3c_validators' do
      with_site do |_site|
        # Create validator
        w3c = Nanoc::Extra::Validators::W3C.new('.', [:foo])

        # Test
        exception = assert_raises Nanoc::Errors::GenericTrivial do
          w3c.run
        end
        assert_equal 'unknown type(s) specified: foo', exception.message
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-3.8.0 test/extra/validators/test_w3c.rb
nanoc-3.7.5 test/extra/validators/test_w3c.rb