Sha256: d15845864c52651746c58ec8368e0893047d3c0dc9459d7a131db57be5c80c41
Contents?: true
Size: 956 Bytes
Versions: 34
Compression:
Stored size: 956 Bytes
Contents
require 'test_helper' module Workarea class ProcessSearchRecommendationsTest < Workarea::TestCase def test_processing_user_activity Recommendation::UserActivity.create!(searches: %w(foo bars)) Recommendation::UserActivity.create!(searches: %w(foo @#$%)) 2.times { Recommendation::UserActivity.create!(searches: %w(foos baz)) } ProcessSearchRecommendations.new.perform predictor = Recommendation::SearchPredictor.new assert_equal(%w(baz bar), predictor.similarities_for('foo')) end def test_within_expiration Recommendation::UserActivity.create!(searches: %w(1 2)) travel_to((Workarea.config.recommendation_expiration + 1.day).from_now) 2.times { Recommendation::UserActivity.create!(searches: %w(1 3)) } ProcessSearchRecommendations.new.perform predictor = Recommendation::SearchPredictor.new assert_equal(%w(3), predictor.similarities_for('1')) end end end
Version data entries
34 entries across 34 versions & 1 rubygems