Sha256: 4540eeee163361eb9afb53245b2103e07238a53e1359c208de46d659666cb5ba
Contents?: true
Size: 1.45 KB
Versions: 3
Compression:
Stored size: 1.45 KB
Contents
require 'test_helper' module Sidekiq module Lock describe Worker do # after { } class CustomContainer def initialize @lock = nil end def fetch @lock end def store(lock) @lock = lock end end # it 'sets lock method that points to thread variable' do # set_lock_variable! "test" # assert_equal "test", LockWorker.new.lock # end it 'allows method name configuration' do begin Sidekiq.lock_method = :custom_lock_name class WorkerWithCustomLockName include Sidekiq::Worker include Sidekiq::Lock::Worker end set_lock_variable! "custom_name" assert_equal "custom_name", WorkerWithCustomLockName.new.custom_lock_name reset_lock_variable! ensure Sidekiq.lock_method = Sidekiq::Lock::METHOD_NAME end end it 'allows container configuration' do begin container = CustomContainer.new Sidekiq.lock_container = container class WorkerWithCustomContainer include Sidekiq::Worker include Sidekiq::Lock::Worker end container.store "lock-variable" assert_equal "lock-variable", WorkerWithCustomContainer.new.lock ensure Sidekiq.lock_container = Sidekiq::Lock::Container.new end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sidekiq-lock-0.6.0 | test/lib/worker_test.rb |
sidekiq-lock-0.5.0 | test/lib/worker_test.rb |
sidekiq-lock-0.4.0 | test/lib/worker_test.rb |