Sha256: 87befa18e21793efc935eabb62ddf98fdf8919da458d3eaf35129e8f4a407fd6

Contents?: true

Size: 934 Bytes

Versions: 14

Compression:

Stored size: 934 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

14 entries across 14 versions & 1 rubygems

Version Path
nanoc-3.7.3 test/extra/validators/test_w3c.rb
nanoc-3.7.2 test/extra/validators/test_w3c.rb
nanoc-3.7.1 test/extra/validators/test_w3c.rb
nanoc-3.7.0 test/extra/validators/test_w3c.rb
nanoc-3.6.11 test/extra/validators/test_w3c.rb
nanoc-3.6.10 test/extra/validators/test_w3c.rb
nanoc-3.6.9 test/extra/validators/test_w3c.rb
nanoc-3.6.8 test/extra/validators/test_w3c.rb
nanoc-3.6.7 test/extra/validators/test_w3c.rb
nanoc-3.6.6 test/extra/validators/test_w3c.rb
nanoc-3.6.5 test/extra/validators/test_w3c.rb
nanoc-3.6.4 test/extra/validators/test_w3c.rb
nanoc-3.6.3 test/extra/validators/test_w3c.rb
nanoc-3.6.2 test/extra/validators/test_w3c.rb