Sha256: 4fe52918f6ff4457429ab6422bb6ad630c51d8ea403c404be8ee810bd9c23222

Contents?: true

Size: 1.01 KB

Versions: 8

Compression:

Stored size: 1.01 KB

Contents

$:.unshift(File.dirname(__FILE__) + '/../lib')
require 'rubygems'
require 'test/unit'
require 'w3c_validators'
require 'vcr'

VCR.configure do |config|
  config.cassette_library_dir = "test/http_recording"
  config.hook_into :webmock # or :fakeweb
end

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

8 entries across 8 versions & 1 rubygems

Version Path
w3c_validators-1.3.7 test/test_helper.rb
w3c_validators-1.3.6 test/test_helper.rb
w3c_validators-1.3.5 test/test_helper.rb
w3c_validators-1.3.4 test/test_helper.rb
w3c_validators-1.3.3 test/test_helper.rb
w3c_validators-1.3.2 test/test_helper.rb
w3c_validators-1.3.1 test/test_helper.rb
w3c_validators-1.3 test/test_helper.rb