Sha256: 878deb3d0226ce2bcd61c0da0d603dcd107b92b750259b67ddc4b56477b9c310

Contents?: true

Size: 1.23 KB

Versions: 15

Compression:

Stored size: 1.23 KB

Contents

# -*- encoding: utf-8 -*-

require_relative '../lib/w3clove'
require_relative './mocks/mocked_validator'
require 'mocha'

$samples_dir = File.dirname(__FILE__) + '/samples'

def message_text(message_id)
  message_texts = {
    '25' => 'general entity "B" not defined and no default entity',
    '325' => 'reference to entity "B" for which no system identifier could be generated',
    '65' => 'document type does not allow element "P" here; missing one of "APPLET", "OBJECT", "MAP", "IFRAME", "BUTTON" start-tag',
    '338' => 'cannot generate system identifier for general entity "B"',
    '247' => 'NET-enabling start-tag requires SHORTTAG YES'
  }
  message_texts[message_id]
end

def stubbed_validator_results(with_errors=true, with_warnings=true)
  fake_validator = W3Clove::MockedValidator.new

  if with_errors
    fake_validator.add_error('25', '92', message_text('25'))
    fake_validator.add_error('325', '92', message_text('325'))
    fake_validator.add_error('325', '224', message_text('325'))
  end

  if with_warnings
    fake_validator.add_warning('338', '92', message_text('338'))
    fake_validator.add_warning('247', '112', message_text('247'))
    fake_validator.add_warning('247', '202', message_text('247'))
  end

  fake_validator
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
w3clove-0.6.1 spec/spec_helper.rb
w3clove-0.6 spec/spec_helper.rb
w3clove-0.5.1 spec/spec_helper.rb
w3clove-0.5 spec/spec_helper.rb
w3clove-0.4.5 spec/spec_helper.rb
w3clove-0.4.4 spec/spec_helper.rb
w3clove-0.4.0 spec/spec_helper.rb
w3clove-0.3.5 spec/spec_helper.rb
w3clove-0.3.4 spec/spec_helper.rb
w3clove-0.3.3 spec/spec_helper.rb
w3clove-0.3.2 spec/spec_helper.rb
w3clove-0.3.1 spec/spec_helper.rb
w3clove-0.3.0 spec/spec_helper.rb
w3clove-0.2.1 spec/spec_helper.rb
w3clove-0.0.2 spec/spec_helper.rb