Sha256: bcdd58d81aee4713b66651a7d58a8ba9d6ac1e9f31cd3468c9b9301377e29a5e

Contents?: true

Size: 819 Bytes

Versions: 1

Compression:

Stored size: 819 Bytes

Contents

# frozen_string_literal: true

begin
  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.each_key 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
  end
rescue LoadError
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspeckled-0.0.37 lib/rspeckled/plugins/sidekiq.rb