Sha256: 2dae083a5f5f026765c0fe829223d8681d3d2124a66e7f2296472224d95289a3

Contents?: true

Size: 1.57 KB

Versions: 12

Compression:

Stored size: 1.57 KB

Contents

require'pact/provider/verification_results/create'
require'pact/provider/verification_results/publish'

module Pact
  module Provider
    module VerificationResults
      class PublishAll

        def self.call pact_sources, test_results_hash, options = {}
          new(pact_sources, test_results_hash, options).call
        end

        def initialize pact_sources, test_results_hash, options = {}
          @pact_sources = pact_sources
          @test_results_hash = test_results_hash
          @options = options
        end

        def call
          verification_results.collect do | (pact_source, verification_result) |
            published = false
            begin
              published = Publish.call(pact_source, verification_result, { verbose: options[:verbose] })
            ensure
              print_after_verification_notices(pact_source, verification_result, published)
            end
          end
        end

        private

        def verification_results
          pact_sources.collect do | pact_source |
            [pact_source, Create.call(pact_source, test_results_hash)]
          end
        end

        def print_after_verification_notices(pact_source, verification_result, published)
          if pact_source.uri.metadata[:notices]
            pact_source.uri.metadata[:notices].after_verification_notices_text(verification_result.success, published).each do | text |
              Pact.configuration.output_stream.puts "DEBUG: #{text}"
            end
          end
        end

        attr_reader :pact_sources, :test_results_hash, :options
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pact-1.65.3 lib/pact/provider/verification_results/publish_all.rb
pact-1.65.2 lib/pact/provider/verification_results/publish_all.rb
pact-1.65.1 lib/pact/provider/verification_results/publish_all.rb
pact-1.65.0 lib/pact/provider/verification_results/publish_all.rb
pact-1.64.0 lib/pact/provider/verification_results/publish_all.rb
pact-1.63.0 lib/pact/provider/verification_results/publish_all.rb
pact-1.62.0 lib/pact/provider/verification_results/publish_all.rb
pact-1.61.0 lib/pact/provider/verification_results/publish_all.rb
pact-1.60.0 lib/pact/provider/verification_results/publish_all.rb
pact-1.59.0 lib/pact/provider/verification_results/publish_all.rb
pact-1.58.0 lib/pact/provider/verification_results/publish_all.rb
pact-1.57.0 lib/pact/provider/verification_results/publish_all.rb