correct time dependent spec

This commit is contained in:
Sam 2018-05-25 14:26:05 +10:00
parent be1b8fc3a8
commit 720a12ce76
1 changed files with 2 additions and 0 deletions

View File

@ -877,6 +877,8 @@ describe UserMerger do
end end
it "merges user visits" do it "merges user visits" do
freeze_time DateTime.parse('2010-01-01 12:00')
UserVisit.create!(user_id: source_user.id, visited_at: 2.days.ago, posts_read: 22, mobile: false, time_read: 400) UserVisit.create!(user_id: source_user.id, visited_at: 2.days.ago, posts_read: 22, mobile: false, time_read: 400)
UserVisit.create!(user_id: source_user.id, visited_at: Date.yesterday, posts_read: 8, mobile: false, time_read: 100) UserVisit.create!(user_id: source_user.id, visited_at: Date.yesterday, posts_read: 8, mobile: false, time_read: 100)
UserVisit.create!(user_id: target_user.id, visited_at: Date.yesterday, posts_read: 12, mobile: true, time_read: 270) UserVisit.create!(user_id: target_user.id, visited_at: Date.yesterday, posts_read: 12, mobile: true, time_read: 270)