diff options
| author | mo khan <mo.khan@gmail.com> | 2020-02-14 10:33:23 -0700 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-02-14 10:33:23 -0700 |
| commit | 94b7c0a650af89f366e5317ff6a28355528ec30b (patch) | |
| tree | 0da64d5d1065587f5a617fba5b1403398a5e87f2 /spec/support | |
| parent | 094cf086bc47e52a9cae19befc05efb82b33da08 (diff) | |
Apply reviewer feedback
Diffstat (limited to 'spec/support')
| -rw-r--r-- | spec/support/integration_test_helper.rb | 6 | ||||
| -rw-r--r-- | spec/support/matchers.rb | 9 |
2 files changed, 10 insertions, 5 deletions
diff --git a/spec/support/integration_test_helper.rb b/spec/support/integration_test_helper.rb index e05ef43..09843c3 100644 --- a/spec/support/integration_test_helper.rb +++ b/spec/support/integration_test_helper.rb @@ -40,4 +40,10 @@ module IntegrationTestHelper def runner(*args) @runner ||= IntegrationTestRunner.new(*args) end + + def find_in(report, name) + report[:dependencies].find do |dependency| + dependency[:name] == name + end + end end 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| |
