diff --git a/spec/models/user_visit_spec.rb b/spec/models/user_visit_spec.rb index ea87011ff3e..658d1a43c2a 100644 --- a/spec/models/user_visit_spec.rb +++ b/spec/models/user_visit_spec.rb @@ -24,18 +24,18 @@ describe UserVisit do describe '#by_day' do before(:each) do Timecop.freeze - user.user_visits.create(visited_at: Time.now) + user.user_visits.create(visited_at: Time.zone.now) user.user_visits.create(visited_at: 1.day.ago) other_user.user_visits.create(visited_at: 1.day.ago) user.user_visits.create(visited_at: 2.days.ago) user.user_visits.create(visited_at: 4.days.ago) end after(:each) { Timecop.return } - let(:visits_by_day) { {1.day.ago.to_date => 2, 2.days.ago.to_date => 1, Time.now.to_date => 1 } } + let(:visits_by_day) { {1.day.ago.to_date => 2, 2.days.ago.to_date => 1, Time.zone.now.to_date => 1 } } it 'collect closed interval visits' do - expect(UserVisit.by_day(2.days.ago, Time.now)).to include(visits_by_day) - expect(UserVisit.by_day(2.days.ago, Time.now)).not_to include({4.days.ago.to_date => 1}) + expect(UserVisit.by_day(2.days.ago, Time.zone.now)).to include(visits_by_day) + expect(UserVisit.by_day(2.days.ago, Time.zone.now)).not_to include({4.days.ago.to_date => 1}) end end end