I am using Sidekiq for background jobs.

I want to run background jobs in Test environment to test some features.

I have read the wiki of sidekiq https://github.com/mperham/sidekiq/wiki/Testing#testing-workers-inline

So I am trying to use that in my spec file but gives me error like

<top (required)>': uninitialized constant Sidekiq::Testing (NameError)

Can anyone help me ?

Thanks

有帮助吗?

解决方案

I got It.

Just need to use require 'sidekiq/testing/inline' in spec_helper.rb

Thats it. No need to write Sidekiq::Testing.inline!

其他提示

Use updated Sidekiq gem version which is compatible with the Rails and ruby versions installed,

gem 'sidekiq', '~> 3.0.0'

Hope it helps :)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top