summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-10-27 12:34:09 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2016-10-27 12:34:35 +0100
commit2822526e7b996c90fb3bbd7c286c2777e5e37360 (patch)
tree6fb6a4951ad4b651193a62e69038fa673cf9b7bc /spec/lib
parent39c17ccb875a90a019a1ac1e9f6c081693197ee8 (diff)
downloadgitlab-ce-2822526e7b996c90fb3bbd7c286c2777e5e37360.tar.gz
Make retry_lock to not be infiniteuse-optimistic-locking
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/optimistic_locking_spec.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/lib/gitlab/optimistic_locking_spec.rb b/spec/lib/gitlab/optimistic_locking_spec.rb
index 75c78cf077a..498dc514c8c 100644
--- a/spec/lib/gitlab/optimistic_locking_spec.rb
+++ b/spec/lib/gitlab/optimistic_locking_spec.rb
@@ -24,5 +24,16 @@ describe Gitlab::OptimisticLocking, lib: true do
subject.drop
end
end
+
+ it 'raises exception when too many retries' do
+ expect(pipeline).to receive(:drop).twice.and_call_original
+
+ expect do
+ described_class.retry_lock(pipeline, 1) do |subject|
+ subject.lock_version = 100
+ subject.drop
+ end
+ end.to raise_error(ActiveRecord::StaleObjectError)
+ end
end
end