Sha256: c9b157b5de446874a556457106f07625eacbe4df18b58628977b72a518286cd1

Contents?: true

Size: 328 Bytes

Versions: 5

Compression:

Stored size: 328 Bytes

Contents

# Matchers to check a json schema
require "json-schema"

RSpec::Matchers.define :match_json_schema do |schema|
  match do |response|
    schema_directory = "#{Dir.pwd}/spec/examples/json_schemas"
    schema_path = "#{schema_directory}/#{schema}.json"
    JSON::Validator.validate!(schema_path, response, strict: true)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
okei-1.0.2 spec/support/matchers/json_schema.rb
okei-1.0.1 spec/support/matchers/json_schema.rb
okei-1.0.0 spec/support/matchers/json_schema.rb
okei-1.0.0.pre.rc spec/support/matchers/json_schema.rb
okei-0.0.2 spec/support/matchers/json_schema.rb