Correct flaky spec
This commit is contained in:
parent
de92913bf4
commit
216f4c99b0
|
@ -273,13 +273,17 @@ RSpec.describe TopicTimer, type: :model do
|
|||
topic: Fabricate(:topic, closed: true)
|
||||
)
|
||||
|
||||
Fabricate(:topic_timer)
|
||||
Fabricate(:topic_timer, execute_at: Time.zone.now + 1.hour)
|
||||
|
||||
Fabricate(:topic_timer,
|
||||
execute_at: Time.zone.now - 1.hour,
|
||||
created_at: Time.zone.now - 2.hour
|
||||
).topic.trash!
|
||||
|
||||
# creating topic timers already enqueues jobs
|
||||
# let's delete them to test ensure_consistency!
|
||||
Sidekiq::Worker.clear_all
|
||||
|
||||
expect { described_class.ensure_consistency! }
|
||||
.to change { Jobs::ToggleTopicClosed.jobs.count }.by(2)
|
||||
|
||||
|
@ -294,19 +298,22 @@ RSpec.describe TopicTimer, type: :model do
|
|||
expect(job_args["state"]).to eq(false)
|
||||
end
|
||||
|
||||
# intermittent failures
|
||||
# it "should enqueue remind me jobs that have been missed" do
|
||||
# reminder = Fabricate(:topic_timer,
|
||||
# status_type: described_class.types[:reminder],
|
||||
# execute_at: Time.zone.now - 1.hour,
|
||||
# created_at: Time.zone.now - 2.hour
|
||||
# )
|
||||
it "should enqueue remind me jobs that have been missed" do
|
||||
reminder = Fabricate(:topic_timer,
|
||||
status_type: described_class.types[:reminder],
|
||||
execute_at: Time.zone.now - 1.hour,
|
||||
created_at: Time.zone.now - 2.hour
|
||||
)
|
||||
|
||||
# expect { described_class.ensure_consistency! }
|
||||
# .to change { Jobs::TopicReminder.jobs.count }.by(1)
|
||||
# creating topic timers already enqueues jobs
|
||||
# let's delete them to test ensure_consistency!
|
||||
Sidekiq::Worker.clear_all
|
||||
|
||||
# job_args = Jobs::TopicReminder.jobs.first["args"].first
|
||||
# expect(job_args["topic_timer_id"]).to eq(reminder.id)
|
||||
# end
|
||||
expect { described_class.ensure_consistency! }
|
||||
.to change { Jobs::TopicReminder.jobs.count }.by(1)
|
||||
|
||||
job_args = Jobs::TopicReminder.jobs.first["args"].first
|
||||
expect(job_args["topic_timer_id"]).to eq(reminder.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue