diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-05 21:10:10 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-05 21:10:10 +0300 |
commit | ea4766228b5536c83f1917d6058be913472ffa2d (patch) | |
tree | 5ebf5ea0f996be6c6908e6b631b72c33bc13e997 /spec/services/authorized_project_update | |
parent | 4b64dc27ae5bac20dec888431c236fef2bfdc449 (diff) |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/services/authorized_project_update')
-rw-r--r-- | spec/services/authorized_project_update/project_group_link_create_service_spec.rb | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/spec/services/authorized_project_update/project_group_link_create_service_spec.rb b/spec/services/authorized_project_update/project_group_link_create_service_spec.rb index d30d9f1e766..961322a1a21 100644 --- a/spec/services/authorized_project_update/project_group_link_create_service_spec.rb +++ b/spec/services/authorized_project_update/project_group_link_create_service_spec.rb @@ -13,8 +13,9 @@ RSpec.describe AuthorizedProjectUpdate::ProjectGroupLinkCreateService do let_it_be(:project) { create(:project, :private, group: create(:group, :private)) } let(:access_level) { Gitlab::Access::MAINTAINER } + let(:group_access) { nil } - subject(:service) { described_class.new(project, group) } + subject(:service) { described_class.new(project, group, group_access) } describe '#perform' do context 'direct group members' do @@ -54,6 +55,26 @@ RSpec.describe AuthorizedProjectUpdate::ProjectGroupLinkCreateService do end end + context 'with group_access' do + let(:group_access) { Gitlab::Access::REPORTER } + + before do + create(:group_member, access_level: access_level, group: group_parent, user: parent_group_user) + ProjectAuthorization.delete_all + end + + it 'creates project authorization' do + expect { service.execute }.to( + change { ProjectAuthorization.count }.from(0).to(1)) + + project_authorization = ProjectAuthorization.where( + project_id: project.id, + user_id: parent_group_user.id, + access_level: group_access) + expect(project_authorization).to exist + end + end + context 'membership overrides' do before do create(:group_member, access_level: Gitlab::Access::REPORTER, group: group_parent, user: group_user) |