Skip to content

A platform for community discussion. Free, open, simple.

DEV: Fix topic timer flaky spec for inheriting from category (#12106)

Martin Brennan3bfb1b34a1f4
diff --git a/spec/models/topic_spec.rb b/spec/models/topic_spec.rb
index 6a63d1578f9..fb451850e07 100644
--- a/spec/models/topic_spec.rb
+++ b/spec/models/topic_spec.rb
@@ -1618,6 +1618,7 @@ describe Topic do
it 'should set a topic timer' do
freeze_time
+ now = Time.zone.now
expect { topic.change_category_to_id(new_category.id) }
.to change { TopicTimer.count }.by(1)
@@ -1628,7 +1629,7 @@ describe Topic do
expect(topic_timer.user).to eq(Discourse.system_user)
expect(topic_timer.topic).to eq(topic)
- expect(topic_timer.execute_at).to be_within_one_second_of(5.hours.from_now)
+ expect(topic_timer.execute_at).to be_within_one_second_of(now + 5.hours)
end
describe 'when topic is already closed' do