DEV: Improve flaky time-sensitive specs (#9141)

This commit is contained in:
Jarek Radosz
2020-03-10 22:13:17 +01:00
committed by GitHub
parent f795c1b8e8
commit 29b35aa64c
49 changed files with 334 additions and 331 deletions

View File

@ -656,8 +656,11 @@ describe Email::Receiver do
end
it "ensures posts aren't dated in the future" do
# PostCreator doesn't provide sub-second accuracy for created_at
now = freeze_time Time.zone.now.round
expect { process(:from_the_future) }.to change { topic.posts.count }
expect(topic.posts.last.created_at).to be_within(1.minute).of(DateTime.now)
expect(topic.posts.last.created_at).to eq_time(now)
end
it "accepts emails with wrong reply key if the system knows about the forwarded email" do