mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:49:14 +08:00
DEV: prevents time difference causing flaky spec (#12108)
This commit is contained in:
parent
237d172fd9
commit
7cad5dfa83
|
@ -1612,12 +1612,12 @@ describe Topic do
|
|||
|
||||
describe 'when new category is set to auto close by default' do
|
||||
before do
|
||||
freeze_time
|
||||
new_category.update!(auto_close_hours: 5)
|
||||
topic.user.update!(admin: true)
|
||||
end
|
||||
|
||||
it 'should set a topic timer' do
|
||||
freeze_time
|
||||
now = Time.zone.now
|
||||
|
||||
expect { topic.change_category_to_id(new_category.id) }
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
RSpec::Matchers.define :be_within_one_second_of do |expected_time|
|
||||
match do |actual_time|
|
||||
(actual_time - expected_time).abs < 1
|
||||
(actual_time - expected_time).abs <= 1
|
||||
end
|
||||
failure_message do |actual_time|
|
||||
"#{actual_time} is not within 1 second of #{expected_time}"
|
||||
|
|
Loading…
Reference in New Issue
Block a user