Welcome to mirror list, hosted at ThFree Co, Russian Federation.

schema_matcher.rb « api « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e42d727672be009d12e71c0428e28aca0bd91ad7 (plain)
1
2
3
4
5
6
7
8
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