Sha256: 5fd2da4fff7560b23c0ac1f8f30e8ffde8f9dcf421395ea2ad03ef5250d5257c

Contents?: true

Size: 643 Bytes

Versions: 2

Compression:

Stored size: 643 Bytes

Contents

require "test_helper"

module Sidekiq
  module Lock
    describe Worker do

      after { set_lock_variable! }

      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
        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
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sidekiq-lock-0.3.0 test/lib/worker_test.rb
sidekiq-lock-0.2.0 test/lib/worker_test.rb