Sha256: cf60af1be99a4b8836034355b945d7d0c7a21279c36f195541e5dc411e5b9246

Contents?: true

Size: 355 Bytes

Versions: 6

Compression:

Stored size: 355 Bytes

Contents

require "rspec/expectations"
require "json-schema"

RSpec::Matchers.define :match_schema do |schema|
  match do |actual|
    JSON::Validator.validate!(schema, actual)
  end
end

RSpec::Matchers.define :match_one_of do |schemas|
  match do |actual|
    JSON::Validator.validate(schemas[0], actual) || JSON::Validator.validate(schemas[1], actual)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
json_test_data-1.2.0 spec/matchers/json_schema_matchers.rb
json_test_data-1.1.3 spec/matchers/json_schema_matchers.rb
json_test_data-1.1.2 spec/matchers/json_schema_matchers.rb
json_test_data-1.1.1 spec/matchers/json_schema_matchers.rb
json_test_data-1.1.0 spec/matchers/json_schema_matchers.rb
json_test_data-1.0.0 spec/matchers/json_schema_matchers.rb