test/lib/middleware_test.rb in sidekiq-lock-0.6.0 vs test/lib/middleware_test.rb in sidekiq-lock-0.7.0
- old
+ new
@@ -13,29 +13,30 @@
end
Sidekiq.redis { |c| c.flushdb }
reset_lock_variable!
end
- let(:handler) { Sidekiq::Lock::Middleware.new }
-
it 'sets lock variable with provided static lock options' do
+ handler = Sidekiq::Lock::Middleware.new
handler.call(LockWorker.new, { 'class' => LockWorker, 'args' => [] }, 'default') do
true
end
assert_kind_of RedisLock, lock_container_variable
end
it 'sets lock variable with provided dynamic options' do
+ handler = Sidekiq::Lock::Middleware.new
handler.call(DynamicLockWorker.new, { 'class' => DynamicLockWorker, 'args' => [1234, 1000] }, 'default') do
true
end
assert_equal "lock:1234", lock_container_variable.name
assert_equal 2000, lock_container_variable.timeout
end
it 'sets nothing for workers without lock options' do
+ handler = Sidekiq::Lock::Middleware.new
handler.call(RegularWorker.new, { 'class' => RegularWorker, 'args' => [] }, 'default') do
true
end
assert_nil lock_container_variable