diff --git a/lib/pact/provider/verification_results/publish.rb b/lib/pact/provider/verification_results/publish.rb index ce812876..c56122f0 100644 --- a/lib/pact/provider/verification_results/publish.rb +++ b/lib/pact/provider/verification_results/publish.rb @@ -81,6 +81,7 @@ def tag_versions provider_application_version = Pact.configuration.provider.application_version Pact.configuration.provider.tags.each do | tag | + Pact.configuration.output_stream.puts "INFO: Tagging version #{provider_application_version} of #{provider_name} as #{tag.inspect}" tag_entity = tag_link.expand(version: provider_application_version, tag: tag).put unless tag_entity.success? raise PublicationError.new("Error returned from tagging request #{tag_entity.response.code} #{tag_entity.response.body}") @@ -109,6 +110,10 @@ def publish_verification_results def consumer_name pact_source.pact_hash['consumer']['name'] end + + def provider_name + pact_source.pact_hash['provider']['name'] + end end end end diff --git a/spec/lib/pact/provider/verification_results/publish_spec.rb b/spec/lib/pact/provider/verification_results/publish_spec.rb index 21e278d0..1260163a 100644 --- a/spec/lib/pact/provider/verification_results/publish_spec.rb +++ b/spec/lib/pact/provider/verification_results/publish_spec.rb @@ -17,6 +17,9 @@ module VerificationResults 'consumer' => { 'name' => 'Foo' }, + 'provider' => { + 'name' => 'Bar' + }, '_links' => { 'pb:publish-verification-results'=> { 'href' => publish_verification_url @@ -121,6 +124,11 @@ module VerificationResults expect(WebMock).to have_requested(:put, 'http://provider/version/1.2.3/tag/foo').with(headers: {'Content-Type' => 'application/json'}) end + it "logs the tagging to stdout" do + expect($stdout).to receive(:puts).with("INFO: Tagging version 1.2.3 of Bar as \"foo\"") + subject + end + context "when there is no pb:publish-verification-results link" do before do pact_hash['_links'].delete('pb:publish-verification-results')