Sha256: 369eab5e23d94c02d308ed5340ce196487b54bd004db90e200b382b1cdc382e8

Contents?: true

Size: 981 Bytes

Versions: 2

Compression:

Stored size: 981 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'

class WithAdvisoryLockConcernTest < GemTestCase
  test 'adds with_advisory_lock to ActiveRecord classes' do
    assert_respond_to(Tag, :with_advisory_lock)
  end

  test 'adds with_advisory_lock to ActiveRecord instances' do
    assert_respond_to(Label.new, :with_advisory_lock)
  end

  test 'adds advisory_lock_exists? to ActiveRecord classes' do
    assert_respond_to(Tag, :advisory_lock_exists?)
  end

  test 'adds advisory_lock_exists? to ActiveRecord instances' do
    assert_respond_to(Label.new, :advisory_lock_exists?)
  end
end

class ActiveRecordQueryCacheTest < GemTestCase
  test 'does not disable quary cache by default' do
    ActiveRecord::Base.expects(:uncached).never
    Tag.with_advisory_lock('lock') { Tag.first }
  end

  test 'can disable ActiveRecord query cache' do
    ActiveRecord::Base.expects(:uncached).once
    Tag.with_advisory_lock('a-lock', disable_query_cache: true) { Tag.first }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
with_advisory_lock-5.1.0 test/concern_test.rb
with_advisory_lock-5.0.0 test/concern_test.rb