match_json_schema.rb 282 B

12345678
  1. # frozen_string_literal: true
  2. RSpec::Matchers.define :match_json_schema do |schema|
  3. match do |input_json|
  4. schema_path = Rails.root.join('spec', 'support', 'schema', "#{schema}.json").to_s
  5. JSON::Validator.validate(schema_path, input_json, validate_schema: true)
  6. end
  7. end