diff options
author | Luke Bennett <lbennett@gitlab.com> | 2019-04-29 14:22:25 +0300 |
---|---|---|
committer | Luke Bennett <lbennett@gitlab.com> | 2019-05-03 19:19:16 +0300 |
commit | 1fb499de278ead55384b13f659a0acfc3680e37f (patch) | |
tree | f96e024de259b68e04e1e180c81704f14b2f174d /spec/features/groups/members | |
parent | 7be2796e24e86c421c8988f454c51755b7f3e153 (diff) |
Add leave link to access_granted email
Allows users to leave a project/group
that they have been added to.
Add function to leave a namespace by url param
If the `leave` param is present on a project/group show page,
click the leave link.
Diffstat (limited to 'spec/features/groups/members')
-rw-r--r-- | spec/features/groups/members/leave_group_spec.rb | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/spec/features/groups/members/leave_group_spec.rb b/spec/features/groups/members/leave_group_spec.rb index 7a91c64d7db..439803f9255 100644 --- a/spec/features/groups/members/leave_group_spec.rb +++ b/spec/features/groups/members/leave_group_spec.rb @@ -21,6 +21,20 @@ describe 'Groups > Members > Leave group' do expect(group.users).not_to include(user) end + it 'guest leaves the group by url param', :js do + group.add_guest(user) + group.add_owner(other_user) + + visit group_path(group, leave: 1) + + page.accept_confirm + + expect(find('.flash-notice')).to have_content "You left the \"#{group.full_name}\" group" + expect(page).to have_content left_group_message(group) + expect(current_path).to eq(dashboard_groups_path) + expect(group.users).not_to include(user) + end + it 'guest leaves the group as last member' do group.add_guest(user) @@ -32,7 +46,7 @@ describe 'Groups > Members > Leave group' do expect(group.users).not_to include(user) end - it 'owner leaves the group if they is not the last owner' do + it 'owner leaves the group if they are not the last owner' do group.add_owner(user) group.add_owner(other_user) @@ -44,7 +58,7 @@ describe 'Groups > Members > Leave group' do expect(group.users).not_to include(user) end - it 'owner can not leave the group if they is a last owner' do + it 'owner can not leave the group if they are the last owner' do group.add_owner(user) visit group_path(group) @@ -56,6 +70,14 @@ describe 'Groups > Members > Leave group' do expect(find(:css, '.project-members-page li', text: user.name)).not_to have_selector(:css, 'a.btn-remove') end + it 'owner can not leave the group by url param if they are the last owner', :js do + group.add_owner(user) + + visit group_path(group, leave: 1) + + expect(find('.flash-alert')).to have_content 'You do not have permission to leave this group' + end + def left_group_message(group) "You left the \"#{group.name}\"" end |