Module: PactBroker::Pacts::PactPublicationWipDatasetModule

Defined in:
lib/pact_broker/pacts/pact_publication_wip_dataset_module.rb

Instance Method Summary collapse

Instance Method Details

#join_branch_versions_excluding_branch(branch_name) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/pact_broker/pacts/pact_publication_wip_dataset_module.rb', line 26

def join_branch_versions_excluding_branch(branch_name)
  branch_versions_join = {
    Sequel[:provider_versions][:id] => Sequel[:branch_versions][:version_id]
  }
  join(:branch_versions, branch_versions_join) do
    Sequel.lit("branch_versions.branch_name != ?", branch_name)
  end
end

#successfully_verified_by_provider_another_branch_before_this_branch_first_created(provider_id, provider_version_branch) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/pact_broker/pacts/pact_publication_wip_dataset_module.rb', line 13

def successfully_verified_by_provider_another_branch_before_this_branch_first_created(provider_id, provider_version_branch)
  first_version_for_branch = PactBroker::Domain::Version.first_for_pacticipant_id_and_branch(provider_id, provider_version_branch)

  from_self(alias: :pp)
    .select(Sequel[:pp].*)
    .join_successful_non_wip_verifications_for_provider_id(provider_id)
    .join_provider_versions_for_provider_id(provider_id)
    .join_branch_versions_excluding_branch(provider_version_branch)
    .where(Sequel[:pp][:provider_id] => provider_id)
    .verified_before_creation_date_of(first_version_for_branch)
    .distinct
end

#successfully_verified_by_provider_another_tag_before_this_tag_first_created(provider_id, provider_tag) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/pact_broker/pacts/pact_publication_wip_dataset_module.rb', line 44

def successfully_verified_by_provider_another_tag_before_this_tag_first_created(provider_id, provider_tag)
  first_tag_with_name = PactBroker::Domain::Tag.where(pacticipant_id: provider_id, name: provider_tag).order(:created_at).first
  from_self(alias: :pp)
    .select(Sequel[:pp].*)
    .where(Sequel[:pp][:provider_id] => provider_id)
    .join_successful_non_wip_verifications_for_provider_id(provider_id)
    .join_provider_version_tags do
      Sequel.lit("provider_tags.name != ?", provider_tag)
    end
    .verified_before_creation_date_of(first_tag_with_name)
    .distinct
end

#successfully_verified_by_provider_branch_when_not_wip(provider_id, provider_version_branch) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/pact_broker/pacts/pact_publication_wip_dataset_module.rb', line 4

def successfully_verified_by_provider_branch_when_not_wip(provider_id, provider_version_branch)
  from_self(alias: :pp)
    .select(Sequel[:pp].*)
    .where(Sequel[:pp][:provider_id] => provider_id)
    .join_successful_non_wip_verifications_for_provider_id(provider_id)
    .join_provider_versions_for_provider_id_and_branch(provider_id, provider_version_branch)
    .distinct
end

#successfully_verified_by_provider_tag_when_not_wip(provider_id, provider_tag) ⇒ Object



35
36
37
38
39
40
41
42
# File 'lib/pact_broker/pacts/pact_publication_wip_dataset_module.rb', line 35

def successfully_verified_by_provider_tag_when_not_wip(provider_id, provider_tag)
  from_self(alias: :pp)
    .select(Sequel[:pp].*)
    .where(Sequel[:pp][:provider_id] => provider_id)
    .join_successful_non_wip_verifications_for_provider_id(provider_id)
    .join_provider_version_tags_for_tag(provider_tag)
    .distinct
end