diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 11:27:35 +0300 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /spec/features/groups_spec.rb | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'spec/features/groups_spec.rb')
-rw-r--r-- | spec/features/groups_spec.rb | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/spec/features/groups_spec.rb b/spec/features/groups_spec.rb index 8264ec2eddd..b9fd3a1a5cc 100644 --- a/spec/features/groups_spec.rb +++ b/spec/features/groups_spec.rb @@ -294,35 +294,43 @@ RSpec.describe 'Group' do describe 'new subgroup / project button' do let(:group) { create(:group, project_creation_level: Gitlab::Access::NO_ONE_PROJECT_ACCESS, subgroup_creation_level: Gitlab::Access::OWNER_SUBGROUP_ACCESS) } - it 'new subgroup button is displayed without project creation permission' do - visit group_path(group) + context 'when user has subgroup creation permissions but not project creation permissions' do + it 'only displays "New subgroup" button' do + visit group_path(group) - page.within '.group-buttons' do - expect(page).to have_link('New subgroup') + page.within '[data-testid="group-buttons"]' do + expect(page).to have_link('New subgroup') + expect(page).not_to have_link('New project') + end end end - it 'new subgroup button is displayed together with new project button when having project creation permission' do - group.update!(project_creation_level: Gitlab::Access::MAINTAINER_PROJECT_ACCESS) - visit group_path(group) + context 'when user has project creation permissions but not subgroup creation permissions' do + it 'only displays "New project" button' do + group.update!(project_creation_level: Gitlab::Access::MAINTAINER_PROJECT_ACCESS) + user = create(:user) - page.within '.group-buttons' do - expect(page).to have_css("li[data-text='New subgroup']", visible: false) - expect(page).to have_css("li[data-text='New project']", visible: false) + group.add_maintainer(user) + sign_out(:user) + sign_in(user) + + visit group_path(group) + page.within '[data-testid="group-buttons"]' do + expect(page).to have_link('New project') + expect(page).not_to have_link('New subgroup') + end end end - it 'new project button is displayed without subgroup creation permission' do - group.update!(project_creation_level: Gitlab::Access::MAINTAINER_PROJECT_ACCESS) - user = create(:user) - - group.add_maintainer(user) - sign_out(:user) - sign_in(user) + context 'when user has project and subgroup creation permissions' do + it 'displays "New subgroup" and "New project" buttons' do + group.update!(project_creation_level: Gitlab::Access::MAINTAINER_PROJECT_ACCESS) + visit group_path(group) - visit group_path(group) - page.within '.group-buttons' do - expect(page).to have_link('New project') + page.within '[data-testid="group-buttons"]' do + expect(page).to have_link('New subgroup') + expect(page).to have_link('New project') + end end end end |