Sha256: 2ed33511dc8c2101efacc774740c7dae69860fa9dd4b35cb73e01455e02422d8
Contents?: true
Size: 1.22 KB
Versions: 62
Compression:
Stored size: 1.22 KB
Contents
require 'test_helper' module Workarea module Insights class PopularSearchesWithoutResultsTest < TestCase def test_results Metrics::SearchByDay.save_search('foo', 0, at: Time.zone.local(2018, 10, 27)) Metrics::SearchByDay.save_search('foo', 0, at: Time.zone.local(2018, 10, 27)) Metrics::SearchByDay.save_search('foo', 0, at: Time.zone.local(2018, 10, 27)) Metrics::SearchByDay.save_search('bar', 0, at: Time.zone.local(2018, 10, 27)) Metrics::SearchByDay.save_search('bar', 0, at: Time.zone.local(2018, 10, 27)) Metrics::SearchByDay.save_search('baz', 1, at: Time.zone.local(2018, 10, 27)) travel_to Time.zone.local(2018, 11, 1) PopularSearchesWithoutResults.generate_monthly! assert_equal(1, PopularSearchesWithoutResults.count) popular_searches = PopularSearchesWithoutResults.first assert_equal(2, popular_searches.results.size) assert_equal('foo', popular_searches.results.first['query_string']) assert_equal(3, popular_searches.results.first['searches']) assert_equal('bar', popular_searches.results.second['query_string']) assert_equal(2, popular_searches.results.second['searches']) end end end end
Version data entries
62 entries across 62 versions & 1 rubygems