Sha256: 4fa84c2b88a5a18d9add75ee01d2802d5a4683eed987cbeac05142cf77405104

Contents?: true

Size: 501 Bytes

Versions: 2

Compression:

Stored size: 501 Bytes

Contents

require "govuk_schemas/validator"

module GovukSchemas
  module RSpecMatchers

    %w[links frontend publisher notification].each do |schema_type|
      RSpec::Matchers.define "be_valid_against_#{schema_type}_schema".to_sym do |schema_name|
        match do |item|
          @validator = GovukSchemas::Validator.new(schema_name, schema_type, item)
          @validator.valid?
        end


        failure_message do |actual|
          @validator.error_message
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
govuk_schemas-4.4.1 lib/govuk_schemas/rspec_matchers.rb
govuk_schemas-4.4.0 lib/govuk_schemas/rspec_matchers.rb