Skip to content

Commit

Permalink
feat: include pact revision number and verification number in badge s…
Browse files Browse the repository at this point in the history
…vg comment
  • Loading branch information
bethesque committed May 3, 2018
1 parent 8fb28ee commit 82b59ef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion lib/pact_broker/api/resources/badge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ def initials

def comment
consumer_version_number = pact ? pact.consumer_version_number : "?"
pact_revision = pact ? pact.revision_number : "?"
provider_version_number = latest_verification ? latest_verification.provider_version_number : "?"
"<!-- #{identifier_from_path[:consumer_name]} version #{consumer_version_number} #{identifier_from_path[:provider_name]} version #{provider_version_number} -->\n"
verification_number = latest_verification ? latest_verification.number : "?"
"<!-- #{identifier_from_path[:consumer_name]} version #{consumer_version_number} revision #{pact_revision} #{identifier_from_path[:provider_name]} version #{provider_version_number} number #{verification_number} -->\n"
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/lib/pact_broker/api/resources/badge_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ module Resources
allow(PactBroker::Verifications::Status).to receive(:new).and_return(verification_status)
end

let(:pact) { instance_double("PactBroker::Domain::Pact", consumer: consumer, provider: provider, consumer_version_number: "2") }
let(:pact) { instance_double("PactBroker::Domain::Pact", consumer: consumer, provider: provider, consumer_version_number: "2", revision_number: "1") }
let(:consumer) { double('consumer') }
let(:provider) { double('provider') }
let(:verification) { double("verification", provider_version_number: "3") }
let(:verification) { double("verification", provider_version_number: "3", number: "7") }
let(:verification_status) { instance_double("PactBroker::Verifications::Status", to_sym: :verified) }


Expand Down Expand Up @@ -86,7 +86,7 @@ module Resources
end

it "returns a comment with the consumer and provider numbers" do
expect(subject.body).to include "<!-- consumer version 2 provider version 3 -->"
expect(subject.body).to include "<!-- consumer version 2 revision 1 provider version 3 number 7 -->"
end

context "when the label param is specified" do
Expand Down

0 comments on commit 82b59ef

Please sign in to comment.