Class: PactBroker::Pacts::VerifiablePactMessages

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/pact_broker/pacts/verifiable_pact_messages.rb

Constant Summary collapse

READ_MORE =
"Read more at https://pact.io/pending"

Instance Method Summary collapse

Constructor Details

#initialize(verifiable_pact) ⇒ VerifiablePactMessages

Returns a new instance of VerifiablePactMessages.



10
11
12
# File 'lib/pact_broker/pacts/verifiable_pact_messages.rb', line 10

def initialize(verifiable_pact)
  @verifiable_pact = verifiable_pact
end

Instance Method Details

#inclusion_reasonObject



14
15
16
17
18
19
20
21
# File 'lib/pact_broker/pacts/verifiable_pact_messages.rb', line 14

def inclusion_reason
  if head_consumer_tags.any?
    version_text = head_consumer_tags.size == 1 ? "version" : "versions"
    "This pact is being verified because it is the pact for the latest #{version_text} of Foo tagged with #{joined_head_consumer_tags}"
  else
    "This pact is being verified because it is the latest pact between #{consumer_name} and #{provider_name}."
  end
end

#pending_reasonObject



23
24
25
26
27
28
29
# File 'lib/pact_broker/pacts/verifiable_pact_messages.rb', line 23

def pending_reason
  if pending?
    "This pact is in pending state because it has not yet been successfully verified by #{pending_provider_tags_description}. If this verification fails, it will not cause the overall build to fail. #{READ_MORE}"
  else
    "This pact has previously been successfully verified by #{non_pending_provider_tags_description}. If this verification fails, it will fail the build. #{READ_MORE}"
  end
end