Sha256: 6d4c21c624c3fa416e51ec7d3ffe79588fcdf78ad15c12e5a4ce28d08b6a8df2

Contents?: true

Size: 833 Bytes

Versions: 3

Compression:

Stored size: 833 Bytes

Contents

require 'test_helper'

module Workarea
  module Metrics
    class SearchByWeekAutocompleteTest < TestCase
      def test_autocomplete
        create_search_by_week(total_results: 0, query_string: 'test one')
        create_search_by_week(total_results: 5, query_string: 'test two', reporting_on: 1.week.ago.beginning_of_week)
        create_search_by_week(total_results: 5, query_string: 'test two', reporting_on: 2.weeks.ago.beginning_of_week)
        create_search_by_week(searches: 3, total_results: 10, query_string: 'test three')
        create_search_by_week(total_results: 15, query_string: 'blah blah blah')

        results = SearchByWeek.autocomplete('tes')
        assert_equal(2, results.size)
        assert_equal('test three', results.first)
        assert_equal('test two', results.second)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
workarea-search_autocomplete-1.0.2 test/models/workarea/metrics/search_by_week_autocomplete_test.rb
workarea-search_autocomplete-1.0.1 test/models/workarea/metrics/search_by_week_autocomplete_test.rb
workarea-search_autocomplete-1.0.0 test/models/workarea/metrics/search_by_week_autocomplete_test.rb