2019-04-29 20:27:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-07-07 12:57:42 -04:00
|
|
|
require "rails_helper"
|
2019-02-13 20:22:40 -05:00
|
|
|
|
|
|
|
RSpec.describe Sidekiq::Pausable do
|
|
|
|
after do
|
2019-02-13 21:33:58 -05:00
|
|
|
Sidekiq.unpause_all!
|
2019-02-13 20:22:40 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it "can still run heartbeats when paused" do
|
|
|
|
Sidekiq.pause!
|
|
|
|
|
|
|
|
freeze_time 1.week.from_now
|
|
|
|
|
|
|
|
jobs = Sidekiq::ScheduledSet.new
|
|
|
|
jobs.clear
|
|
|
|
middleware = Sidekiq::Pausable.new
|
|
|
|
|
|
|
|
middleware.call(Jobs::RunHeartbeat.new, { "args" => [{}] }, "critical") do
|
|
|
|
"done"
|
|
|
|
end
|
|
|
|
|
|
|
|
jobs = Sidekiq::ScheduledSet.new
|
|
|
|
expect(jobs.size).to eq(0)
|
|
|
|
end
|
|
|
|
end
|