Sha256: 8b86b1df8b76c16bf014d7d847af93d7923a9514af3a4e2c324c7590bb617d79

Contents?: true

Size: 851 Bytes

Versions: 1

Compression:

Stored size: 851 Bytes

Contents

# frozen_string_literal: true
begin
  require 'sidekiq/testing'

  RSpec.configure do |config|
    config.before(:each) do |example|
      # Clears out the jobs for tests using the fake testing
      Sidekiq::Worker.clear_all

      if example.metadata[:queue] == :stub
        Sidekiq::Testing.fake!
      elsif example.metadata[:queue] == :immediately_execute
        Sidekiq::Testing.inline!
        @redis_connection = Redis.new

        allow(Sidekiq::RedisConnection).to receive(:build_client).
        and_return(@redis_connection)
      elsif example.metadata[:type] == :feature
        Sidekiq::Testing.inline!
        @redis_connection = Redis.new

        allow(Sidekiq::RedisConnection).to receive(:build_client).
        and_return(@redis_connection)
      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.17 lib/rspeckled/plugins/sidekiq.rb