breamware / sidekiq-batch

Sidekiq Batch Jobs Implementation
MIT License
357 stars 95 forks source link

Stubbing in rspec in tests #71

Closed Overload119 closed 1 year ago

Overload119 commented 1 year ago

This gem uses Sidekiq.redis directly so but with the following snippet:

if Rails.env.test?
  # This is in here instead of rails_helper.rb so that E2E tests work as well.
  require 'sidekiq/testing'
  Sidekiq::Testing.fake!
end

There is no Redis client, it fails.

Any known workarounds?

Overload119 commented 1 year ago

Here's a workaround I'm using in my tests:

allow_any_instance_of(Sidekiq::Batch).to receive(:jobs) { |&blck| blck.call }
github-actions[bot] commented 1 year ago

Stale issue message