-
Notifications
You must be signed in to change notification settings - Fork 132
FAQ & Troubleshooting
- Sidekiq stops processing jobs when using rspec-sidekiq
- "WARNING! Sidekiq will *NOT* process jobs in this environment" message
- "have_enqueued_jobs matcher has been removed from rspec-sidekiq 1.x.x." message
rspec-sidekiq performs a require "sidekiq/testing"
for you, meaning that Sidekiq jobs will not be pushed to Redis but instead to a jobs
array to enable testing.
This is not a feature of rspec-sidekiq but of Sidekiq. See https://github.com/mperham/sidekiq/wiki/Testing for more information.
This warning means that Sidekiq jobs will not be enqueued to Redis but instead to a jobs
array so that testing can occur.
See Sidekiq stops processing jobs when using rspec-sidekiq for more information.
Add the following configuration to your spec_helper.rb
file...
(In case you have rspec 3 or higher you should add it to rails_helper.rb
instead)
RSpec::Sidekiq.configure do |config|
config.warn_when_jobs_not_processed_by_sidekiq = false
end
Add the following configuration to your spec_helper.rb
file...
RSpec::Sidekiq.configure do |config|
config.enable_terminal_colours = false
end
The have_enqueued_jobs
matcher has been remove from rspec-sidekiq 1.x.x and up due to a better syntax already being available from RSpec. E.g.
# RSpec 2.x
expect(Job).to have(2).jobs
# or
expect(Job).to have(2).enqueued.jobs
# RSpec 3.x
expect(Job.jobs.size).to eq(2)