-
-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add revisions per consumer version and verifications per pact v…
…ersion to metrics
- Loading branch information
Showing
2 changed files
with
77 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
require 'pact_broker/metrics/service' | ||
|
||
module PactBroker | ||
module Metrics | ||
module Service | ||
describe "#metrics" do | ||
subject { Service.metrics } | ||
|
||
describe "verificationResultsPerPactVersion" do | ||
before do | ||
td.create_pact_with_hierarchy | ||
.comment("this pact version will have 2 verifications") | ||
.create_verification | ||
.create_verification(number: 2) | ||
.revise_pact | ||
.comment("this pact version will have 1 verification") | ||
.create_verification | ||
.create_consumer_version | ||
.create_pact | ||
.comment("this pact will have 1 verification") | ||
.create_verification | ||
.create_consumer_version | ||
.create_pact | ||
.comment("this pact will have 1 verification") | ||
.create_verification | ||
end | ||
|
||
let(:distribution) { subject[:verificationResultsPerPactVersion][:distribution] } | ||
|
||
it "returns a distribution of verifications per pact version" do | ||
expect(distribution).to eq(1 => 3, 2 => 1) | ||
end | ||
end | ||
|
||
describe "pactRevisionsPerPactPublication" do | ||
before do | ||
td.create_pact_with_hierarchy | ||
.comment("this consumer version will have 3 revisions") | ||
.revise_pact | ||
.revise_pact | ||
.create_consumer_version | ||
.create_pact | ||
.comment("this consumer version will have 1 revision") | ||
.revise_pact | ||
end | ||
|
||
let(:distribution) { subject[:pactRevisionsPerConsumerVersion][:distribution] } | ||
|
||
it "returns a distribution of pact revisions per consumer version" do | ||
expect(distribution).to eq(2 => 1, 3 => 1) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |