DEV: Fix hot topic flaky spec ()

It's February 29th, you know what that means...date-based flaky specs! If today is
February 29th 2024:

```
freeze_time(1.year.ago) -> Tue, 28 Feb 2023 01:38:42.732875000 UTC +00:00
```

Then

```
freeze_time(1.year.from_now) -> Wed, 28 Feb 2024 01:38:42.732875000 UTC +00:00
```

So then our "now" for the insert query ends up being "yesterday"

```
WHERE topic_hot_scores.topic_id IS NULL
  AND topics.deleted_at IS NULL
  AND topics.archetype <> :private_message
  AND topics.created_at <= :now
```
This commit is contained in:
Martin Brennan 2024-02-29 11:54:36 +10:00 committed by GitHub
parent 53069fcb8e
commit 120a2f70a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -29,7 +29,8 @@ RSpec.describe TopicHotScore do
end end
it "can correctly update like counts and post counts and account for activity" do it "can correctly update like counts and post counts and account for activity" do
freeze_time # freeze to specific date + time to avoid flakiness from leap years
freeze_time(DateTime.parse("2024-02-01 01:00"))
TopicHotScore.create!(topic_id: -1, score: 0.0, recent_likes: 99, recent_posters: 0) TopicHotScore.create!(topic_id: -1, score: 0.0, recent_likes: 99, recent_posters: 0)