diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-09 15:09:21 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-09 15:09:21 +0000 |
commit | d2675fa4de909714fcc6dc1bdd7bee9ce5e3af34 (patch) | |
tree | 0c0fbdd55fbb3a1616b10775113bf8320c9529c8 /spec/controllers/groups/group_members_controller_spec.rb | |
parent | 48d25238c386a89e8a6af218eeb290936a8f7595 (diff) | |
download | gitlab-ce-d2675fa4de909714fcc6dc1bdd7bee9ce5e3af34.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/groups/group_members_controller_spec.rb')
-rw-r--r-- | spec/controllers/groups/group_members_controller_spec.rb | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/spec/controllers/groups/group_members_controller_spec.rb b/spec/controllers/groups/group_members_controller_spec.rb index 25d32436d58..c6fd184ede0 100644 --- a/spec/controllers/groups/group_members_controller_spec.rb +++ b/spec/controllers/groups/group_members_controller_spec.rb @@ -305,11 +305,37 @@ RSpec.describe Groups::GroupMembersController do group.add_owner(user) end - it 'cannot removes himself from the group' do + it 'cannot remove user from the group' do delete :leave, params: { group_id: group } expect(response).to have_gitlab_http_status(:forbidden) end + + context 'and there is a group project bot owner' do + before do + create(:group_member, :owner, source: group, user: create(:user, :project_bot)) + end + + it 'cannot remove user from the group' do + delete :leave, params: { group_id: group } + + expect(response).to have_gitlab_http_status(:forbidden) + end + end + + context 'and there is another owner' do + before do + create(:group_member, :owner, source: group) + end + + it 'removes user from members', :aggregate_failures do + delete :leave, params: { group_id: group } + + expect(controller).to set_flash.to "You left the \"#{group.name}\" group." + expect(response).to redirect_to(dashboard_groups_path) + expect(group.users).not_to include user + end + end end context 'and is a requester' do |