From b93b8cdab62679936af10cd8f41878a6c8f4da22 Mon Sep 17 00:00:00 2001 From: Volodymyr Makukh Date: Wed, 19 Apr 2023 08:12:45 +0300 Subject: [PATCH] Fix flaky reporting_event_listener_spec (#6923) --- spec/listeners/reporting_event_listener_spec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/listeners/reporting_event_listener_spec.rb b/spec/listeners/reporting_event_listener_spec.rb index 2f0fc24bd..3151b714c 100644 --- a/spec/listeners/reporting_event_listener_spec.rb +++ b/spec/listeners/reporting_event_listener_spec.rb @@ -63,8 +63,9 @@ describe ReportingEventListener do # this ensures last_non_human_activity method accurately accounts for handoff events context 'when last handoff event exists' do - let(:conversation_updated_at) { 20.seconds.from_now } - let(:human_message_created_at) { 62.seconds.from_now } + let(:now) { Time.zone.now } + let(:conversation_updated_at) { now + 20.seconds } + let(:human_message_created_at) { now + 62.seconds } let(:new_conversation) { create(:conversation, account: account, inbox: inbox, assignee: user, updated_at: conversation_updated_at) } let(:new_message) do create(:message, message_type: 'outgoing', created_at: human_message_created_at, account: account, inbox: inbox,