FEATURE: remove the timecop gem

We should only have one way of mocking time, misuse of timecop
was causing build stability issues
This commit is contained in:
Sam Saffron
2017-07-24 09:17:42 -04:00
committed by Sam
parent 40174962e2
commit 045a2abcec
35 changed files with 459 additions and 473 deletions

View File

@ -33,11 +33,7 @@ describe Topic do
context 'jobs may be queued' do
before do
SiteSetting.queue_jobs = true
Timecop.freeze(Time.zone.now)
end
after do
Timecop.return
freeze_time
end
context 'category has a default auto-close' do
@ -78,14 +74,14 @@ describe Topic do
context 'topic is closed manually' do
it 'should remove the schedule to auto-close the topic' do
Timecop.freeze do
topic_timer_id = staff_topic.public_topic_timer.id
freeze_time
staff_topic.update_status('closed', true, admin)
topic_timer_id = staff_topic.public_topic_timer.id
expect(TopicTimer.with_deleted.find(topic_timer_id).deleted_at)
.to be_within(1.second).of(Time.zone.now)
end
staff_topic.update_status('closed', true, admin)
expect(TopicTimer.with_deleted.find(topic_timer_id).deleted_at)
.to be_within(1.second).of(Time.zone.now)
end
end
end