debian-mirror-gitlab/spec/support/api/schema_matcher.rb
2016-09-13 17:45:13 +05:30

8 lines
286 B
Ruby

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"
JSON::Validator.validate!(schema_path, response.body, options)
end
end