metamaps--metamaps/spec/support/schema_matcher.rb

8 lines
249 B
Ruby
Raw Normal View History

RSpec::Matchers.define :match_json_schema do |schema|
match do |json|
schema_directory = Rails.root.join('spec', 'schemas').to_s
schema_path = "#{schema_directory}/#{schema}.json"
JSON::Validator.validate!(schema_path, json)
end
end