Class: PactBroker::Matrix::IntegrationsRepository

Inherits:
Object
  • Object
show all
Defined in:
lib/pact_broker/matrix/integrations_repository.rb

Instance Method Summary collapse

Instance Method Details

#find_integrations_for_specified_selectors(resolved_specified_selectors, infer_selectors_for_integrations) ⇒ Array<PactBroker::Matrix::Integration>

Find all the Integrations required for this query, using the options to determine whether to find the inferred integrations or not. The infer_selectors_for_integrations only makes a difference when there are multiple selectors. When it is false, then only integrations are returned that exist between the versions of the selectors. When it is true, then all integrations that involve any of the versions of the selectors are returned.

eg. Foo v1 has verified contract with Bar v2 Waffle v3 has verified contract with Bar v2 Foo v1 has unverified contract with Frog

With selectors Foo v1 and Bar v2, and infer_selectors_for_integrations false, the returned integrations are Foo/Bar With the same selectors and infer_selectors_for_integrations true, the returned integrations are Foo/Bar, Waffle/Bar and Foo/Frog.

When there is a single selector, the result is exactly the same whether infer_selectors_for_integrations is true or false.

Parameters:

Returns:



33
34
35
36
37
38
39
# File 'lib/pact_broker/matrix/integrations_repository.rb', line 33

def find_integrations_for_specified_selectors(resolved_specified_selectors, infer_selectors_for_integrations)
  if infer_selectors_for_integrations || resolved_specified_selectors.size == 1
    find_integrations_involving_any_specfied_selectors(resolved_specified_selectors).sort_by(&:pacticipant_names)
  else
    find_integrations_between_specified_selectors(resolved_specified_selectors).sort_by(&:pacticipant_names)
  end
end