diff options
| author | Can Eldem <celdem@gitlab.com> | 2020-01-16 10:24:11 +0000 |
|---|---|---|
| committer | Can Eldem <celdem@gitlab.com> | 2020-01-16 10:24:11 +0000 |
| commit | 2074e7e5ea3012be6f3a72bd4af934a42b7202ca (patch) | |
| tree | ce9ec33580f0e6e3f9cf3df1aab2f2cf7b5601cb /spec/support/matchers.rb | |
| parent | f4f59927f87944a4d73be26416a7334521875f40 (diff) | |
| parent | 34f162a4903d852d47bd5440839f7519eb6fa8f0 (diff) | |
Merge branch '12012-pipfile-lock' into 'master'v2.4.0
Add support for Pipfile.lock
See merge request gitlab-org/security-products/license-management!103
Diffstat (limited to 'spec/support/matchers.rb')
| -rw-r--r-- | spec/support/matchers.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb new file mode 100644 index 0000000..1d1c263 --- /dev/null +++ b/spec/support/matchers.rb @@ -0,0 +1,14 @@ +RSpec::Matchers.define :match_schema do |version: '2.0'| + match do |actual| + schema = License::Management.root + .join("spec/fixtures/schema/v#{version}.json") + .to_s + @errors = JSON::Validator.fully_validate(schema, actual) + @errors.empty? + end + + failure_message do |response| + "didn't match the schema for version #{version}" \ + " The validation errors were:\n#{@errors.join("\n")}" + end +end |
