Floor times in tests

This passed locally for me on macOS but does not pass on Linux due to a difference in precision for timestamps.
This commit is contained in:
Karina Kwiatek 2023-05-07 21:04:21 +02:00
parent eca53de004
commit 81b279f1b6
2 changed files with 2 additions and 2 deletions

View File

@ -68,7 +68,7 @@ describe InboxController, type: :controller do
it "updates the the timestamp used for caching" do it "updates the the timestamp used for caching" do
user.update(inbox_updated_at: original_inbox_updated_at) user.update(inbox_updated_at: original_inbox_updated_at)
travel 1.second do travel 1.second do
expect { subject }.to change { user.reload.inbox_updated_at }.from(original_inbox_updated_at).to(Time.now.utc) expect { subject }.to change { user.reload.inbox_updated_at.floor }.from(original_inbox_updated_at.floor).to(Time.now.utc.floor)
end end
end end

View File

@ -45,7 +45,7 @@ describe NotificationsController do
it "updates the the timestamp used for caching" do it "updates the the timestamp used for caching" do
user.update(notifications_updated_at: original_notifications_updated_at) user.update(notifications_updated_at: original_notifications_updated_at)
travel 1.second do travel 1.second do
expect { subject }.to change { user.reload.notifications_updated_at }.from(original_notifications_updated_at).to(Time.now.utc) expect { subject }.to change { user.reload.notifications_updated_at.floor }.from(original_notifications_updated_at.floor).to(Time.now.utc.floor)
end end
end end
end end