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:
Diffstat (limited to 'spec/services/members/update_highest_role_service_spec.rb')
-rw-r--r--spec/services/members/update_highest_role_service_spec.rb44
1 files changed, 0 insertions, 44 deletions
diff --git a/spec/services/members/update_highest_role_service_spec.rb b/spec/services/members/update_highest_role_service_spec.rb
deleted file mode 100644
index 6fcb939203d..00000000000
--- a/spec/services/members/update_highest_role_service_spec.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-# frozen_string_literal: true
-
-require 'spec_helper'
-require 'sidekiq/testing'
-
-describe Members::UpdateHighestRoleService, :clean_gitlab_redis_shared_state do
- include ExclusiveLeaseHelpers
-
- let_it_be(:user) { create(:user) }
- let_it_be(:lease_key) { "update_highest_role:#{user.id}" }
- let(:service) { described_class.new(user.id) }
-
- describe '#perform' do
- subject { service.execute }
-
- context 'when lease is obtained' do
- it 'takes the lease but does not release it', :aggregate_failures do
- expect_to_obtain_exclusive_lease(lease_key, 'uuid', timeout: described_class::LEASE_TIMEOUT)
-
- subject
-
- expect(service.exclusive_lease.exists?).to be_truthy
- end
-
- it 'schedules a job in the future', :aggregate_failures do
- expect(UpdateHighestRoleWorker).to receive(:perform_in).with(described_class::DELAY, user.id).and_call_original
-
- Sidekiq::Testing.fake! do
- expect { subject }.to change(UpdateHighestRoleWorker.jobs, :size).by(1)
- end
- end
- end
-
- context 'when lease cannot be obtained' do
- it 'only schedules one job' do
- Sidekiq::Testing.fake! do
- stub_exclusive_lease_taken(lease_key, timeout: described_class::LEASE_TIMEOUT)
-
- expect { subject }.not_to change(UpdateHighestRoleWorker.jobs, :size)
- end
- end
- end
- end
-end