Sha256: 03a083cf7f8c363029819ea76f95344d3ea7b84ff7e835bf51d5a5fe32aea3f0
Contents?: true
Size: 777 Bytes
Versions: 2
Compression:
Stored size: 777 Bytes
Contents
# frozen_string_literal: true require 'test_helper' class LockNestingTest < GemTestCase setup do @prior_prefix = ENV['WITH_ADVISORY_LOCK_PREFIX'] ENV['WITH_ADVISORY_LOCK_PREFIX'] = nil end teardown do ENV['WITH_ADVISORY_LOCK_PREFIX'] = @prior_prefix end test "doesn't request the same lock twice" do impl = WithAdvisoryLock::Base.new(nil, nil, nil) assert_empty(impl.lock_stack) Tag.with_advisory_lock('first') do assert_equal(%w[first], impl.lock_stack.map(&:name)) # Even MySQL should be OK with this: Tag.with_advisory_lock('first') do assert_equal(%w[first], impl.lock_stack.map(&:name)) end assert_equal(%w[first], impl.lock_stack.map(&:name)) end assert_empty(impl.lock_stack) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
with_advisory_lock-5.1.0 | test/nesting_test.rb |
with_advisory_lock-5.0.0 | test/nesting_test.rb |