summaryrefslogtreecommitdiff
path: root/spec/support/matchers.rb
diff options
context:
space:
mode:
authorTetiana Chupryna <tchupryna@gitlab.com>2020-02-17 10:58:47 +0000
committerTetiana Chupryna <tchupryna@gitlab.com>2020-02-17 10:58:47 +0000
commita307d82c1f855b1d1b113289216911c168523a2f (patch)
tree712c39bf7972f70669d1be33e6b653356adebcae /spec/support/matchers.rb
parentc6f2ad7ea95cae4d4f4f8e192eeab8b466dfd166 (diff)
parent94b7c0a650af89f366e5317ff6a28355528ec30b (diff)
Merge branch '198043-gradle-scanning' into 'master'v2.4.3
Scan projects with bundled gradle wrapper See merge request gitlab-org/security-products/license-management!109
Diffstat (limited to 'spec/support/matchers.rb')
-rw-r--r--spec/support/matchers.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb
index 1d1c263..12bbdf7 100644
--- a/spec/support/matchers.rb
+++ b/spec/support/matchers.rb
@@ -1,10 +1,9 @@
RSpec::Matchers.define :match_schema do |version: '2.0'|
+ def schema_for(version)
+ License::Management.root.join("spec/fixtures/schema/v#{version}.json").to_s
+ end
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?
+ !actual.nil? && JSON::Validator.fully_validate(schema_for(version), actual).empty?
end
failure_message do |response|