module Workarea::Factories::Metrics

Public Instance Methods

create_product_by_week(overrides = {}) click to toggle source
# File lib/workarea/testing/factories/metrics.rb, line 10
def create_product_by_week(overrides = {})
  attributes = factory_defaults(:insights_product_by_week).merge(overrides)
  Workarea::Metrics::ProductByWeek.create!(attributes).tap do
    Factories::Metrics.product_by_week_count += 1
  end
end
create_search_by_week(overrides = {}) click to toggle source
# File lib/workarea/testing/factories/metrics.rb, line 17
def create_search_by_week(overrides = {})
  attributes = factory_defaults(:insights_search_by_week).merge(overrides)
  attributes[:query_id] ||= QueryString.new(attributes[:query_string]).id

  Workarea::Metrics::SearchByWeek.create!(attributes).tap do
    Factories::Metrics.search_by_week_count += 1
  end
end