summaryrefslogtreecommitdiff
path: root/spec/services/groups
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-08-22 08:52:30 +0000
committerDouwe Maan <douwe@gitlab.com>2017-08-22 08:52:30 +0000
commit28501691da41e1593a822061549d29a6a946d7a3 (patch)
tree376e74fd2b77d7c269a7f511864611c37f46223f /spec/services/groups
parentc0563b8bf6f22fb72bd3dffe660a21c1fba4684e (diff)
parent5bc9dedf401a10388b9505ccbc11d4802ff76a43 (diff)
downloadgitlab-ce-28501691da41e1593a822061549d29a6a946d7a3.tar.gz
Merge branch '35845-improve-subgroup-creation-permissions' into 'master'
Improves subgroup creation permissions Closes #35845 See merge request !13418
Diffstat (limited to 'spec/services/groups')
-rw-r--r--spec/services/groups/create_service_spec.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/services/groups/create_service_spec.rb b/spec/services/groups/create_service_spec.rb
index b2175717a70..6973e7ff990 100644
--- a/spec/services/groups/create_service_spec.rb
+++ b/spec/services/groups/create_service_spec.rb
@@ -32,12 +32,24 @@ describe Groups::CreateService, '#execute' do
end
it { is_expected.to be_persisted }
+
+ context 'when nested groups feature is disabled' do
+ it 'does not save group and returns an error' do
+ allow(Group).to receive(:supports_nested_groups?).and_return(false)
+
+ is_expected.not_to be_persisted
+ expect(subject.errors[:parent_id]).to include('You don’t have permission to create a subgroup in this group.')
+ expect(subject.parent_id).to be_nil
+ end
+ end
end
context 'as guest' do
it 'does not save group and returns an error' do
+ allow(Group).to receive(:supports_nested_groups?).and_return(true)
+
is_expected.not_to be_persisted
- expect(subject.errors[:parent_id].first).to eq('manage access required to create subgroup')
+ expect(subject.errors[:parent_id].first).to eq('You don’t have permission to create a subgroup in this group.')
expect(subject.parent_id).to be_nil
end
end