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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-04-16 21:09:14 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-16 21:09:14 +0300
commitac99f7b78181f31d4b41b74b04038d11881aaa7f (patch)
tree7e5f54056bb49c99e8a9742516a03628ad0bdee5 /spec/services
parent7f70c3a95c6c7635234b822bc50b6d476a4d9929 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/authorized_project_update/find_records_due_for_refresh_service_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/services/authorized_project_update/find_records_due_for_refresh_service_spec.rb b/spec/services/authorized_project_update/find_records_due_for_refresh_service_spec.rb
index cdc93eaa365..8a53d9fbf7c 100644
--- a/spec/services/authorized_project_update/find_records_due_for_refresh_service_spec.rb
+++ b/spec/services/authorized_project_update/find_records_due_for_refresh_service_spec.rb
@@ -94,6 +94,41 @@ RSpec.describe AuthorizedProjectUpdate::FindRecordsDueForRefreshService do
end
end
+ describe '#needs_refresh?' do
+ subject { service.needs_refresh? }
+
+ context 'when there are records due for either removal or addition' do
+ context 'when there are both removals and additions to be made' do
+ before do
+ user.project_authorizations.delete_all
+ create(:project_authorization, user: user)
+ end
+
+ it { is_expected.to eq(true) }
+ end
+
+ context 'when there are no removals, but there are additions to be made' do
+ before do
+ user.project_authorizations.delete_all
+ end
+
+ it { is_expected.to eq(true) }
+ end
+
+ context 'when there are no additions, but there are removals to be made' do
+ before do
+ create(:project_authorization, user: user)
+ end
+
+ it { is_expected.to eq(true) }
+ end
+ end
+
+ context 'when there are no additions or removals to be made' do
+ it { is_expected.to eq(false) }
+ end
+ end
+
describe '#fresh_access_levels_per_project' do
let(:hash) { service.fresh_access_levels_per_project }