mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 01:16:38 -06:00
DEV: improve flaky spec
This handles a lot of date calculations, keep the baseline time consistent so it is not prone to issues when running out UTC threshold
This commit is contained in:
parent
a49e484519
commit
926bd712bf
@ -51,6 +51,7 @@ describe DirectoryItem do
|
||||
|
||||
context 'refresh' do
|
||||
before do
|
||||
freeze_time DateTime.parse('2017-02-02 12:00')
|
||||
UserActionManager.enable
|
||||
end
|
||||
|
||||
@ -89,11 +90,13 @@ describe DirectoryItem do
|
||||
it "handles users with no activity" do
|
||||
post = nil
|
||||
|
||||
freeze_time(2.years.ago) do
|
||||
post = create_post
|
||||
# Create records for that activity
|
||||
DirectoryItem.refresh!
|
||||
end
|
||||
freeze_time(2.years.ago)
|
||||
|
||||
post = create_post
|
||||
# Create records for that activity
|
||||
DirectoryItem.refresh!
|
||||
|
||||
freeze_time(2.years.from_now)
|
||||
|
||||
DirectoryItem.refresh!
|
||||
[:yearly, :monthly, :weekly, :daily, :quarterly].each do |period|
|
||||
|
Loading…
Reference in New Issue
Block a user