0
我正在嘗試爲使用Sidetiq的Sidekiq作業編寫一些測試,但似乎無法使其工作。我在sidetiq repo上發現了一個處理這個問題的問題,但是沒有人回答它,所以我想我可以將它帶到stackoverflow以獲得一些答案和清晰度。使用TimeCop進行Sidetiq測試
這裏是鏈接到的問題:https://github.com/tobiassvn/sidetiq/issues/72
這裏是將似乎沒有工作代碼:
spec.rb
# sat 1st feb
Timecop.travel Time.local(2014, 2, 1, 1, 1, 1) do
sign_up_and_onboard user[:email], user[:password]
# sunday 2nd feb, 8pm
Timecop.travel Time.local(2014, 2, 2, 20, 1, 1) do
puts 'should have fired'
end
end
worker.rb
recurrence { weekly.day(:sunday).hour_of_day(8) }
def perform
puts 'test'
end
再次感謝你的幫助。