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.
11 12 13 14 |
# File 'lib/pact_broker/pacts/verifiable_pact_messages.rb', line 11 def initialize(verifiable_pact, pact_version_url) @verifiable_pact = verifiable_pact @pact_version_url = pact_version_url end |
Instance Method Details
#inclusion_reason ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/pact_broker/pacts/verifiable_pact_messages.rb', line 26 def inclusion_reason version_text = .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 Foo tagged with #{joined_head_consumer_tags} 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
16 17 18 19 20 21 22 23 24 |
# File 'lib/pact_broker/pacts/verifiable_pact_messages.rb', line 16 def pact_description position_descs = if .empty? ["latest"] else .collect { | tag | "latest #{tag}"} end "Pact between #{consumer_name} and #{provider_name}, consumer version #{consumer_version_number}, #{position_descs.join(",")}" end |
#pact_version_short_description ⇒ Object
67 68 69 |
# File 'lib/pact_broker/pacts/verifiable_pact_messages.rb', line 67 def pact_version_short_description short_selector_descriptions end |
#pending_reason ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/pact_broker/pacts/verifiable_pact_messages.rb', line 37 def pending_reason if pending? "This pact is in pending state for this version of #{provider_name} because a successful verification result for #{pending_provider_tags_description("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 #{non_pending_provider_tags_description}. If this verification fails, it will fail the build. #{READ_MORE_PENDING}" end end |
#verification_success_false_published_false ⇒ Object
57 58 59 60 61 |
# File 'lib/pact_broker/pacts/verifiable_pact_messages.rb', line 57 def verification_success_false_published_false if pending? "This pact is still in pending state for #{pending_provider_tags_description} as a successful verification result #{with_these_tags}has not yet been published" end end |
#verification_success_false_published_true ⇒ Object
63 64 65 |
# File 'lib/pact_broker/pacts/verifiable_pact_messages.rb', line 63 def verification_success_false_published_true verification_success_false_published_false end |
#verification_success_true_published_false ⇒ Object
45 46 47 48 49 |
# File 'lib/pact_broker/pacts/verifiable_pact_messages.rb', line 45 def verification_success_true_published_false if pending? "This pact is still in pending state for #{pending_provider_tags_description} as the successful verification results #{with_these_tags}have not yet been published." end end |
#verification_success_true_published_true ⇒ Object
51 52 53 54 55 |
# File 'lib/pact_broker/pacts/verifiable_pact_messages.rb', line 51 def verification_success_true_published_true if pending? "This pact is no longer in pending state for #{pending_provider_tags_description}, as a successful verification result #{with_these_tags}has been published. If a verification for a version with fails in the future, it will fail the build. #{READ_MORE_PENDING}" end end |