Testing Sidekiq workers using Rspec

守給你的承諾、 提交于 2019-12-24 03:54:06

问题


How do i test the following line of code invokes 'perform' in 5 mins using rspec?

CustomSidekiqWorker.perform_in(5.minutes, parameter1)

回答1:


If you've set Sidekiq to use inline processing while runnings tests like so:

require 'sidekiq/testing'
Sidekiq::Testing.inline!

Then the following should work in your specs:

expect(CustomSideWorker).to receive(:perform_in).with(5.minutes, parameter1)


来源:https://stackoverflow.com/questions/27899120/testing-sidekiq-workers-using-rspec

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!