Sha256: 67b1fbc69a31a572945cfc7de6630a9c91ba68fc682f99a720d1b0b0da465122

Contents?: true

Size: 739 Bytes

Versions: 2

Compression:

Stored size: 739 Bytes

Contents

module W3cRspecValidators
  
  RSpec::Matchers.define :be_valid_html do
    validator = Validator.new
    match do |body|
      validator.validate_html(body)
      validator.response.errors.length == 0
    end
    failure_message_for_should do |actual|
      validator.response.errors.map do |err|
        ErrorParser.parse_html_error(err, actual)
      end.join("\n")
    end
  end
  
  RSpec::Matchers.define :be_valid_css do
    validator = Validator.new
    match do |css|
      validator.validate_css css
      validator.response.errors.length == 0
    end

    failure_message_for_should do |actual|
      validator.response.errors.map do |err|
        ErrorParser.parse_css_error(err, actual)
      end.join("\n")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
w3c_rspec_validators-0.2.1 lib/w3c_rspec_validators/rspec.rb
w3c_rspec_validators-0.2.0 lib/w3c_rspec_validators/rspec.rb