Sha256: 5cd51c26452e9a406abd7a9baee78ca0a0f278bcb582960bba6ab4f5dcaa03c4

Contents?: true

Size: 1.26 KB

Versions: 34

Compression:

Stored size: 1.26 KB

Contents

# All of these pacts have the same underlying pact_version_sha (content)
# No point verifying them multiple times, so squash all the relevant info into one
# "verifiable pact"

module PactBroker
  module Pacts
    module SquashPactsForVerification
      def self.call(provider_version_tags, selected_pact, include_pending_status = false)
        domain_pact = selected_pact.pact

        if include_pending_status
          pending_provider_tags = []
          pending = nil
          if provider_version_tags.any?
            pending_provider_tags = domain_pact.select_pending_provider_version_tags(provider_version_tags)
            pending = pending_provider_tags.any?
          else
            pending = domain_pact.pending?
          end
          non_pending_provider_tags = provider_version_tags - pending_provider_tags
          VerifiablePact.new(
            domain_pact,
            selected_pact.selectors,
            pending,
            pending_provider_tags,
            non_pending_provider_tags
          )
        else
          VerifiablePact.new(
            domain_pact,
            selected_pact.selectors
          )
        end
      end

      def squash_pacts_for_verification(*args)
        SquashPactsForVerification.call(*args)
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
pact_broker-2.104.0 lib/pact_broker/pacts/squash_pacts_for_verification.rb
pact_broker-2.103.0 lib/pact_broker/pacts/squash_pacts_for_verification.rb
pact_broker-2.102.2 lib/pact_broker/pacts/squash_pacts_for_verification.rb
pact_broker-2.102.1 lib/pact_broker/pacts/squash_pacts_for_verification.rb
pact_broker-2.102.0 lib/pact_broker/pacts/squash_pacts_for_verification.rb
pact_broker-2.101.0 lib/pact_broker/pacts/squash_pacts_for_verification.rb
pact_broker-2.100.0 lib/pact_broker/pacts/squash_pacts_for_verification.rb
pact_broker-2.99.0 lib/pact_broker/pacts/squash_pacts_for_verification.rb
pact_broker-2.98.0 lib/pact_broker/pacts/squash_pacts_for_verification.rb
pact_broker-2.97.0 lib/pact_broker/pacts/squash_pacts_for_verification.rb
pact_broker-2.96.0 lib/pact_broker/pacts/squash_pacts_for_verification.rb
pact_broker-2.95.1 lib/pact_broker/pacts/squash_pacts_for_verification.rb
pact_broker-2.95.0 lib/pact_broker/pacts/squash_pacts_for_verification.rb
pact_broker-2.94.0 lib/pact_broker/pacts/squash_pacts_for_verification.rb
pact_broker-2.93.4 lib/pact_broker/pacts/squash_pacts_for_verification.rb
pact_broker-2.93.3 lib/pact_broker/pacts/squash_pacts_for_verification.rb
pact_broker-2.93.2 lib/pact_broker/pacts/squash_pacts_for_verification.rb
pact_broker-2.93.1 lib/pact_broker/pacts/squash_pacts_for_verification.rb
pact_broker-2.93.0 lib/pact_broker/pacts/squash_pacts_for_verification.rb
pact_broker-2.92.0 lib/pact_broker/pacts/squash_pacts_for_verification.rb