From 18aa8276861a8f0d68f7ed78e325e6d8c86cc683 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Tue, 25 Jul 2017 22:14:32 +0100 Subject: [PATCH] Remove timecop dependence --- spec/jobs/regular/notify_chats_spec.rb | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/spec/jobs/regular/notify_chats_spec.rb b/spec/jobs/regular/notify_chats_spec.rb index 27d917f..3221b10 100644 --- a/spec/jobs/regular/notify_chats_spec.rb +++ b/spec/jobs/regular/notify_chats_spec.rb @@ -16,19 +16,20 @@ RSpec.describe PostCreator do end it 'should schedule a chat notification job' do - Timecop.freeze do - post = PostCreator.new(topic.user, - raw: 'Some post content', - topic_id: topic.id - ).create! + freeze_time + + post = PostCreator.new(topic.user, + raw: 'Some post content', + topic_id: topic.id + ).create! - job = Jobs::NotifyChats.jobs.last + job = Jobs::NotifyChats.jobs.last - expect(job['at']) - .to eq((Time.zone.now + SiteSetting.chat_integration_delay_seconds.seconds).to_f) + expect(job['at']) + .to eq((Time.zone.now + SiteSetting.chat_integration_delay_seconds.seconds).to_f) - expect(job['args'].first['post_id']).to eq(post.id) - end + expect(job['args'].first['post_id']).to eq(post.id) + end end