Module: PactBroker::Pacts::PactPublicationCleanSelectorDatasetModule

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

Instance Method Summary collapse

Instance Method Details

#latest_by_consumer_tag_for_clean_selector(selector) ⇒ Object

we’ve already done the latest_by_consumer_tag in the clean



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

def latest_by_consumer_tag_for_clean_selector(selector)
  query = latest_by_consumer_tag
  query = query.for_consumer_name(selector.pacticipant_name) if selector.pacticipant_name
  query = query.for_consumer_version_tag(selector.tag) if selector.tag && selector.tag.is_a?(String)
  query = query.where_age_less_than(selector.max_age) if selector.max_age
  query
end

#where_age_less_than(days) ⇒ Object



13
14
15
16
# File 'lib/pact_broker/pacts/pact_publication_clean_selector_dataset_module.rb', line 13

def where_age_less_than(days)
  start_date = Date.today - days
  where{ pact_publications[:created_at] >= start_date }
end