metamaps--metamaps/spec/support/schema_matcher.rb
2016-02-09 11:20:39 +08:00

7 lines
249 B
Ruby

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