summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Papa <fabtheman@gmail.com>2019-06-14 15:16:55 -0700
committerFabio Papa <fabtheman@gmail.com>2019-06-14 15:16:55 -0700
commit1f07faa95a60983e4623845f451e89a5b2c92bbe (patch)
tree7ab71f46892b9a065655b5a763c7878ccbdae3c2
parent56861a19a3466342ed8a489b417c3630c9d61fed (diff)
downloadgitlab-ce-1f07faa95a60983e4623845f451e89a5b2c92bbe.tar.gz
Add failing feature spec detailing a maintainer creating a subgroup
- Change the two existing feature examples that create a subgroup to elucidate that the owner is creating the subgroup - Nest two more specs inside the 'subgroup support' context detailing what happens when a maintainer attempts to add a subgroup (one with subgroup support, and one without)
-rw-r--r--spec/features/groups/show_spec.rb61
1 files changed, 48 insertions, 13 deletions
diff --git a/spec/features/groups/show_spec.rb b/spec/features/groups/show_spec.rb
index 9671a4d8c49..2654d06cd8c 100644
--- a/spec/features/groups/show_spec.rb
+++ b/spec/features/groups/show_spec.rb
@@ -56,32 +56,67 @@ describe 'Group show page' do
end
context 'subgroup support' do
- let(:user) { create(:user) }
+ let(:owner) { create(:user) }
+ let(:maintainer) { create(:user) }
before do
- group.add_owner(user)
- sign_in(user)
+ group.add_owner(owner)
+ group.add_maintainer(maintainer)
end
- context 'when subgroups are supported', :js, :nested_groups do
+ context 'for owners' do
before do
- allow(Group).to receive(:supports_nested_objects?) { true }
- visit path
+ sign_in(owner)
end
- it 'allows creating subgroups' do
- expect(page).to have_css("li[data-text='New subgroup']", visible: false)
+ context 'when subgroups are supported', :js, :nested_groups do
+ before do
+ allow(Group).to receive(:supports_nested_objects?) { true }
+ visit path
+ end
+
+ it 'allows creating subgroups' do
+ expect(page).to have_css("li[data-text='New subgroup']", visible: false)
+ end
+ end
+
+ context 'when subgroups are not supported' do
+ before do
+ allow(Group).to receive(:supports_nested_objects?) { false }
+ visit path
+ end
+
+ it 'allows creating subgroups' do
+ expect(page).not_to have_selector("li[data-text='New subgroup']", visible: false)
+ end
end
end
- context 'when subgroups are not supported' do
+ context 'for maintainers' do
before do
- allow(Group).to receive(:supports_nested_objects?) { false }
- visit path
+ sign_in(maintainer)
+ end
+
+ context 'when subgroups are supported', :js, :nested_groups do
+ before do
+ allow(Group).to receive(:supports_nested_objects?) { true }
+ visit path
+ end
+
+ it 'allows creating subgroups' do
+ expect(page).to have_css("li[data-text='New subgroup']", visible: false)
+ end
end
- it 'allows creating subgroups' do
- expect(page).not_to have_selector("li[data-text='New subgroup']", visible: false)
+ context 'when subgroups are not supported' do
+ before do
+ allow(Group).to receive(:supports_nested_objects?) { false }
+ visit path
+ end
+
+ it 'allows creating subgroups' do
+ expect(page).not_to have_selector("li[data-text='New subgroup']", visible: false)
+ end
end
end
end