Class: PactBroker::Pacts::BuildVerifiablePactNotices

Inherits:
Object
  • Object
show all
Defined in:
lib/pact_broker/pacts/build_verifiable_pact_notices.rb

Class Method Summary collapse

Class Method Details

.append_notice(notices, the_when, text) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/pact_broker/pacts/build_verifiable_pact_notices.rb', line 28

def self.append_notice notices, the_when, text
  if text
    notices << {
      when: the_when,
      text: text
    }
  end
end

.call(verifiable_pact, pact_url, options) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/pact_broker/pacts/build_verifiable_pact_notices.rb', line 7

def self.call(verifiable_pact, pact_url, options)
  messages = VerifiablePactMessages.new(verifiable_pact, pact_url)

  notices = []

  if options[:deprecated]
    append_notice(notices, "before_verification", "WARNING - this version of the Pact library uses a beta version of the API which will be removed in the future. Please upgrade your Pact library. See https://docs.pact.io/pact_broker/advanced_topics/provider_verification_results/#pacts-for-verification for minimum required versions.")
  end

  append_notice(notices, "before_verification", messages.inclusion_reason)

  if options[:include_pending_status]
    append_notice(notices, "before_verification", messages.pending_reason)
    append_notice(notices, "after_verification:success_true_published_false", messages.verification_success_true_published_false)
    append_notice(notices, "after_verification:success_false_published_false", messages.verification_success_false_published_false)
    append_notice(notices, "after_verification:success_true_published_true", messages.verification_success_true_published_true)
    append_notice(notices, "after_verification:success_false_published_true", messages.verification_success_false_published_true)
  end
  notices
end