From efb9b032951115b8fb2e8e84ce4f006509850d6f Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Fri, 18 Aug 2023 18:22:45 +0200 Subject: [PATCH] Compare time using string representation --- spec/controllers/ajax/answer_controller_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/controllers/ajax/answer_controller_spec.rb b/spec/controllers/ajax/answer_controller_spec.rb index 1f1632f2..2a8906ca 100644 --- a/spec/controllers/ajax/answer_controller_spec.rb +++ b/spec/controllers/ajax/answer_controller_spec.rb @@ -334,7 +334,8 @@ describe Ajax::AnswerController, :ajax_controller, type: :controller do initial_timestamp = 1.day.ago answer.user.update(inbox_updated_at: initial_timestamp) travel_to 1.day.from_now do - expect { subject }.to(change { answer.user.reload.inbox_updated_at }.from(initial_timestamp).to(DateTime.now)) + # using string representation to avoid precision issues + expect { subject }.to(change { answer.user.reload.inbox_updated_at.to_s }.from(initial_timestamp.to_s).to(DateTime.now)) end end end