-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy pathconcern_test.rb
33 lines (26 loc) · 981 Bytes
/
concern_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 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 query 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