diff --git a/lib/pact/pact_broker/pact_selection_description.rb b/lib/pact/pact_broker/pact_selection_description.rb index 369dc891..6b6a8110 100644 --- a/lib/pact/pact_broker/pact_selection_description.rb +++ b/lib/pact/pact_broker/pact_selection_description.rb @@ -39,6 +39,12 @@ def pact_selection_description(provider, consumer_version_selectors, options, br elsif selector[:environment] desc = "currently in #{selector[:environment]}" desc = "#{selector[:consumer]} #{desc}" if selector[:consumer] + elsif selector[:matchingBranch] + desc = "matching current branch" + desc = "#{desc} for #{selector[:consumer]}" if selector[:consumer] + elsif selector[:matchingTag] + desc = "matching tag" + desc = "#{desc} for #{selector[:consumer]}" if selector[:consumer] else desc = selector.to_s end diff --git a/spec/lib/pact/pact_broker/pact_selection_description_spec.rb b/spec/lib/pact/pact_broker/pact_selection_description_spec.rb index 98e5e47b..cb93143c 100644 --- a/spec/lib/pact/pact_broker/pact_selection_description_spec.rb +++ b/spec/lib/pact/pact_broker/pact_selection_description_spec.rb @@ -67,6 +67,18 @@ module PactBroker it { is_expected.to include "in production" } end + describe "matching branch" do + let(:consumer_version_selectors) { [{ matchingBranch: true, consumer: "Foo" }] } + + it { is_expected.to include "matching current branch for Foo" } + end + + describe "matching tag" do + let(:consumer_version_selectors) { [{ matchingTag: true, consumer: "Foo" }] } + + it { is_expected.to include "matching tag for Foo" } + end + describe "unknown" do let(:consumer_version_selectors) { [{ branchPattern: "*foo" }] }