module Sidekiq

@api private

See Sidekiq gem for more details

Public Class Methods

use_options(tmp_config = {}) { || ... } click to toggle source

Temporarily turn Sidekiq's options into something different

@note this method will restore the original options after yielding

@param [Hash<Symbol, Object>] tmp_config the temporary config to use

# File lib/sidekiq_unique_jobs/testing.rb, line 24
def self.use_options(tmp_config = {})
  old_options = default_worker_options.dup

  default_worker_options.clear
  self.default_worker_options = tmp_config
  yield
ensure
  default_worker_options.clear
  self.default_worker_options = DEFAULT_WORKER_OPTIONS
  self.default_worker_options = old_options
end