Sha256: da3297fa6a9b28a368242582384b849f32f222ed630b8c27466742fb2aff38b2

Contents?: true

Size: 997 Bytes

Versions: 1

Compression:

Stored size: 997 Bytes

Contents

RSpec.configure do |config|
  VERSION_REGEX = /(?<operator>[<>=]+)?\s?(?<version>(\d+.?)+)/m
  config.before(:each) do |example|
    SidekiqUniqueJobs.configure do |config|
      config.redis_test_mode = :redis
    end

    if (sidekiq = example.metadata[:sidekiq])
      sidekiq = :fake if sidekiq == true
      Sidekiq::Testing.send("#{sidekiq}!")
    end

    if (sidekiq_ver = example.metadata[:sidekiq_ver])
      VERSION_REGEX.match(sidekiq_ver.to_s) do |match|
        version  = match[:version]
        operator = match[:operator]

        raise 'Please specify how to compare the version with >= or < or =' unless operator

        unless Sidekiq::VERSION.send(operator, version)
          skip('Skipped due to version check (requirement was that sidekiq version is ' \
               "#{operator} #{version}; was #{Sidekiq::VERSION})")
        end
      end
    end
  end

  config.after(:each) do |example|
    Sidekiq::Testing.disable! unless example.metadata[:sidekiq].nil?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sidekiq-unique-jobs-4.0.18 spec/support/sidekiq_meta.rb