Kamesh
Kamesh

Reputation: 1465

Testing Sidekiq workers using Rspec

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

CustomSidekiqWorker.perform_in(5.minutes, parameter1)

Upvotes: 2

Views: 3468

Answers (1)

Philip Hallstrom
Philip Hallstrom

Reputation: 19899

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)

Upvotes: 7

Related Questions