Module: PactBroker::Pacts::SquashPactsForVerification

Included in:
Service
Defined in:
lib/pact_broker/pacts/squash_pacts_for_verification.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(provider_version_tags, provider_version_branch, selected_pact, include_pending_status = false) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/pact_broker/pacts/squash_pacts_for_verification.rb', line 8

def self.call(provider_version_tags, provider_version_branch, selected_pact, include_pending_status = false)
  domain_pact = selected_pact.pact

  if include_pending_status
    pending_provider_tags = []
    pending = nil
    if provider_version_branch
      pending = domain_pact.pending_for_provider_branch?(provider_version_branch)
    elsif 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_for_any_provider_branch?
    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,
      provider_version_branch
    )
  else
    VerifiablePact.new(
      domain_pact,
      selected_pact.selectors
    )
  end
end

Instance Method Details

#squash_pacts_for_verification(*args) ⇒ Object



39
40
41
# File 'lib/pact_broker/pacts/squash_pacts_for_verification.rb', line 39

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