Sha256: 3d3a8e0efbeda9b44ee74439a97aee41a1c5a3b50f72249eaf9bcfc448fe8cbd

Contents?: true

Size: 847 Bytes

Versions: 4

Compression:

Stored size: 847 Bytes

Contents

# frozen_string_literal: true

require 'sidekiq/testing'

RSpec.configure do |config|
  config.before(:each, :queue => lambda { |v| !!v }) do |example|
    # Clears out the jobs for tests using the fake testing
    Sidekiq::Worker.clear_all
    Sidekiq::Queues.clear_all
    Sidekiq.redis { |r| r.__send__(:instance_variable_get, :@redis).flushdb }
    Sidekiq.redis do |client|
      client.keys.each do |key|
        client.del(key)
      end
    end

    if example.metadata[:queue] == :stub
      Sidekiq::Testing.fake!
    elsif example.metadata[:queue] == :immediately_execute
      Sidekiq::Testing.inline!
    elsif example.metadata[:type] == :feature
      Sidekiq::Testing.inline!
    else
      Sidekiq::Testing.fake!
    end
  end

  config.after(:each, :queue => lambda { |v| !!v }) do |_example|
    Sidekiq::Testing.fake!
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rspeckled-0.0.58 lib/rspeckled/plugins/sidekiq.rb
rspeckled-0.0.57 lib/rspeckled/plugins/sidekiq.rb
rspeckled-0.0.56 lib/rspeckled/plugins/sidekiq.rb
rspeckled-0.0.55 lib/rspeckled/plugins/sidekiq.rb