Sha256: 1cb2a2b8877956a28672f55ef78a6e41db5d49c1aaf989c5e5273084d61a3da8

Contents?: true

Size: 983 Bytes

Versions: 1

Compression:

Stored size: 983 Bytes

Contents

$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__), '../'))
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__), '../lib/'))

require 'rubygems'
require 'test/unit'
require 'w3c_validators'

class Test::Unit::TestCase

  def assert_no_errors(response)
    assert response.errors.empty?, response.errors.map { |e| e.to_s }.join('. ')
  end
  
  def assert_no_warnings(response)
    assert response.warnings.empty?, response.warnings.map { |w| w.to_s }.join('. ')
  end
  
  def assert_errors(response, quantity = nil)
    case quantity
      when 0
        assert_no_errors response
      when nil
        assert response.errors.any?
      else
        assert_equal quantity, response.errors.length
    end
  end
  
  def assert_warnings(response, quantity = nil)
    case quantity
      when 0
        assert_no_warnings response
      when nil
        assert response.warnings.any?
      else
        assert_equal quantity, response.warnings.length
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
w3c_validators-1.0.2 test/test_helper.rb