Sha256: 4e3252aaafcd6079629e6d6c58c296409f025e1aa86d92e8f46edfa2250419d4

Contents?: true

Size: 886 Bytes

Versions: 2

Compression:

Stored size: 886 Bytes

Contents

$:.unshift(File.dirname(__FILE__) + '/../lib')
require 'iconv'
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

2 entries across 2 versions & 1 rubygems

Version Path
w3c_validators-1.1.1 test/test_helper.rb
w3c_validators-1.1 test/test_helper.rb