Class: Eco::API::UseCases::GraphQL::Samples::Pages::Template::Deploy::Verifier::QaVerifier

Inherits:
Verifier
  • Object
show all
Defined in:
lib/eco/api/usecases/graphql/samples/pages/template/deploy/verifier.rb

Overview

Adapter onto the ecoportal-qa check runner. Kept dependency-free at load time — it only touches Ecoportal::QA inside #verify, so requiring this file never forces the qa gem. The exact qa runner API is intentionally accessed through a single seam (run_qa) so it is easy to correct once the qa public surface stabilises (see TODO).

TODO(qa-integration): the qa check-runner public API is still moving (see the qa repo's PHASE3-SCOPE.md). This adapter assumes a check_set.run(doc)-style entry returning objects responding to #pass? and #findings. Confirm and adjust run_qa when qa is pinned as a dep.

Instance Method Summary collapse

Constructor Details

#initialize(check_set: nil) ⇒ QaVerifier

Returns a new instance of QaVerifier.



90
91
92
93
# File 'lib/eco/api/usecases/graphql/samples/pages/template/deploy/verifier.rb', line 90

def initialize(check_set: nil)
  super()
  @check_set = check_set
end

Instance Method Details

#verify(template_doc) ⇒ Object



95
96
97
98
99
100
101
# File 'lib/eco/api/usecases/graphql/samples/pages/template/deploy/verifier.rb', line 95

def verify(template_doc)
  result = run_qa(template_doc)
  Verdict.new(pass: result_pass?(result), verifier: 'ecoportal-qa', findings: result_findings(result))
rescue StandardError => e
  Verdict.new(pass: false, verifier: 'ecoportal-qa',
              findings: [{ severity: :error, message: "qa verification raised: #{e.message}" }])
end