blob: 929b637e5eb2be065bde0fd90f9086eaaf379ae3 (
plain)
1
2
3
4
5
6
7
8
9
|
RSpec::Matchers.define :match_response_schema do |schema, options = {}|
match do |response|
schema_directory = "#{Dir.pwd}/spec/fixtures/api/schemas"
schema_path = "#{schema_directory}/#{schema}.json"
list = options.fetch(:array, false)
JSON::Validator.validate!(schema_path, response.body, list: list)
end
end
|