Testing Sidekiq Workers Using Rspec

How can I test the following line of code calls "run" in 5 minutes using rspec?

CustomSidekiqWorker.perform_in(5.minutes, parameter1)

      

+1


source to share


1 answer


If you installed Sidekiq to use inline processing when running tests like this:

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

      



Then the following should work in your specs:

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

      

+6


source







All Articles