diff options
Diffstat (limited to 'spec/lib/gitlab/exclusive_lease_helpers_spec.rb')
-rw-r--r-- | spec/lib/gitlab/exclusive_lease_helpers_spec.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/spec/lib/gitlab/exclusive_lease_helpers_spec.rb b/spec/lib/gitlab/exclusive_lease_helpers_spec.rb index 40669f06371..8bf06bcebe2 100644 --- a/spec/lib/gitlab/exclusive_lease_helpers_spec.rb +++ b/spec/lib/gitlab/exclusive_lease_helpers_spec.rb @@ -88,7 +88,7 @@ RSpec.describe Gitlab::ExclusiveLeaseHelpers, :clean_gitlab_redis_shared_state d let(:options) { { retries: 0 } } it 'never sleeps' do - expect(class_instance).not_to receive(:sleep) + expect_any_instance_of(Gitlab::ExclusiveLeaseHelpers::SleepingLock).not_to receive(:sleep) expect { subject }.to raise_error('Failed to obtain a lock') end @@ -98,7 +98,7 @@ RSpec.describe Gitlab::ExclusiveLeaseHelpers, :clean_gitlab_redis_shared_state d let(:options) { { retries: 1, sleep_sec: 0.05.seconds } } it 'receives the specified argument' do - expect_any_instance_of(Object).to receive(:sleep).with(0.05.seconds).once + expect_any_instance_of(Gitlab::ExclusiveLeaseHelpers::SleepingLock).to receive(:sleep).with(0.05.seconds).once expect { subject }.to raise_error('Failed to obtain a lock') end @@ -108,8 +108,8 @@ RSpec.describe Gitlab::ExclusiveLeaseHelpers, :clean_gitlab_redis_shared_state d let(:options) { { retries: 2, sleep_sec: ->(num) { 0.1 + num } } } it 'receives the specified argument' do - expect_any_instance_of(Object).to receive(:sleep).with(1.1.seconds).once - expect_any_instance_of(Object).to receive(:sleep).with(2.1.seconds).once + expect_any_instance_of(Gitlab::ExclusiveLeaseHelpers::SleepingLock).to receive(:sleep).with(1.1.seconds).once + expect_any_instance_of(Gitlab::ExclusiveLeaseHelpers::SleepingLock).to receive(:sleep).with(2.1.seconds).once expect { subject }.to raise_error('Failed to obtain a lock') end |