Class: PactBroker::Pacts::VerifiablePactMessages
- Inherits:
-
Object
- Object
- PactBroker::Pacts::VerifiablePactMessages
- Extended by:
- Forwardable
- Defined in:
- lib/pact_broker/pacts/verifiable_pact_messages.rb
Constant Summary collapse
- READ_MORE_PENDING =
"Read more at https://pact.io/pending"
- READ_MORE_WIP =
"Read more at https://pact.io/wip"
Instance Method Summary collapse
- #inclusion_reason ⇒ Object
-
#initialize(verifiable_pact, pact_version_url) ⇒ VerifiablePactMessages
constructor
A new instance of VerifiablePactMessages.
- #pact_description ⇒ Object
- #pact_version_short_description ⇒ Object
- #pending_reason ⇒ Object
- #verification_success_false_published_false ⇒ Object
- #verification_success_false_published_true ⇒ Object
- #verification_success_true_published_false ⇒ Object
- #verification_success_true_published_true ⇒ Object
Constructor Details
#initialize(verifiable_pact, pact_version_url) ⇒ VerifiablePactMessages
Returns a new instance of VerifiablePactMessages.
13 14 15 16 |
# File 'lib/pact_broker/pacts/verifiable_pact_messages.rb', line 13 def initialize(verifiable_pact, pact_version_url) @verifiable_pact = verifiable_pact @pact_version_url = pact_version_url end |
Instance Method Details
#inclusion_reason ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/pact_broker/pacts/verifiable_pact_messages.rb', line 28 def inclusion_reason version_text = .size == 1 || branches.size == 1 ? "version" : "versions" if wip? # WIP pacts will always have tags, because it is part of the definition of being a WIP pact "The pact at #{pact_version_url} is being verified because it is a 'work in progress' pact (ie. it is the pact for the latest #{version_text} of #{consumer_name} #{} and is still in pending state). #{READ_MORE_WIP}" else criteria_or_criterion = selectors.size > 1 ? "criteria" : "criterion" "The pact at #{pact_version_url} is being verified because it matches the following configured selection #{criteria_or_criterion}: #{selector_descriptions}#{same_content_note}" end end |
#pact_description ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/pact_broker/pacts/verifiable_pact_messages.rb', line 18 def pact_description position_descs = if .empty? && branches.empty? ["latest"] else .collect { |tag| "latest with tag #{tag}" } + branches.collect{ |branch| "latest from branch #{branch}" } end "Pact between #{consumer_name} and #{provider_name}, consumer version #{consumer_version_number}, #{position_descs.join(", ")}" end |
#pact_version_short_description ⇒ Object
69 70 71 |
# File 'lib/pact_broker/pacts/verifiable_pact_messages.rb', line 69 def pact_version_short_description short_selector_descriptions end |
#pending_reason ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/pact_broker/pacts/verifiable_pact_messages.rb', line 39 def pending_reason if pending? "This pact is in pending state for this version of #{provider_name} because a successful verification result for #{("a")} has not yet been published. If this verification fails, it will not cause the overall build to fail. #{READ_MORE_PENDING}" else "This pact has previously been successfully verified by #{}. If this verification fails, it will fail the build. #{READ_MORE_PENDING}" end end |
#verification_success_false_published_false ⇒ Object
59 60 61 62 63 |
# File 'lib/pact_broker/pacts/verifiable_pact_messages.rb', line 59 def verification_success_false_published_false if pending? "This pact is still in pending state for #{} as a successful verification result #{}has not yet been published" end end |
#verification_success_false_published_true ⇒ Object
65 66 67 |
# File 'lib/pact_broker/pacts/verifiable_pact_messages.rb', line 65 def verification_success_false_published_true verification_success_false_published_false end |
#verification_success_true_published_false ⇒ Object
47 48 49 50 51 |
# File 'lib/pact_broker/pacts/verifiable_pact_messages.rb', line 47 def verification_success_true_published_false if pending? "This pact is still in pending state for #{} as the successful verification results #{}have not yet been published." end end |
#verification_success_true_published_true ⇒ Object
53 54 55 56 57 |
# File 'lib/pact_broker/pacts/verifiable_pact_messages.rb', line 53 def verification_success_true_published_true if pending? "This pact is no longer in pending state for #{}, as a successful verification result #{}has been published. If a verification for a version of #{provider_name} #{}fails in the future, it will fail the build. #{READ_MORE_PENDING}" end end |