Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2018-06-29 20:54:01 +0300
committerRobert Speicher <robert@gitlab.com>2018-06-29 20:54:01 +0300
commitefaca5ded0033a60b822f4081c29b1544ed321c7 (patch)
tree73d073313c128003cb6a166dbdf453313d3f3e05 /spec/models/concerns
parent70cf3bff18e358beaff9efc52906748636718d99 (diff)
parent34dbccb24b38c5a7c52641e7008f3ab53b25c66a (diff)
Merge branch 'da-exclusive-lease-helpers' into 'master'
Add helper methods to stub Gitlab::ExclusiveLease See merge request gitlab-org/gitlab-ce!20253
Diffstat (limited to 'spec/models/concerns')
-rw-r--r--spec/models/concerns/reactive_caching_spec.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/spec/models/concerns/reactive_caching_spec.rb b/spec/models/concerns/reactive_caching_spec.rb
index f2a3df50c1a..0f156619e9e 100644
--- a/spec/models/concerns/reactive_caching_spec.rb
+++ b/spec/models/concerns/reactive_caching_spec.rb
@@ -1,6 +1,7 @@
require 'spec_helper'
describe ReactiveCaching, :use_clean_rails_memory_store_caching do
+ include ExclusiveLeaseHelpers
include ReactiveCachingHelpers
class CacheTest
@@ -106,8 +107,8 @@ describe ReactiveCaching, :use_clean_rails_memory_store_caching do
end
it 'takes and releases the lease' do
- expect_any_instance_of(Gitlab::ExclusiveLease).to receive(:try_obtain).and_return("000000")
- expect(Gitlab::ExclusiveLease).to receive(:cancel).with(cache_key, "000000")
+ expect_to_obtain_exclusive_lease(cache_key, 'uuid')
+ expect_to_cancel_exclusive_lease(cache_key, 'uuid')
go!
end
@@ -153,11 +154,9 @@ describe ReactiveCaching, :use_clean_rails_memory_store_caching do
end
context 'when the lease is already taken' do
- before do
- expect_any_instance_of(Gitlab::ExclusiveLease).to receive(:try_obtain).and_return(nil)
- end
-
it 'skips the calculation' do
+ stub_exclusive_lease_taken(cache_key)
+
expect(instance).to receive(:calculate_reactive_cache).never
go!