summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorFabio Papa <fabtheman@gmail.com>2019-06-30 14:40:23 -0700
committerFabio Papa <fabtheman@gmail.com>2019-07-05 10:03:18 -0700
commita39a4e4509f5272bc5b4001cded198ebd7d98614 (patch)
tree405aa7afeef793aa0a4edd660339411383341d1d /spec
parent8b8172c1e4738fece547492dee6e3a7a61e8d50e (diff)
downloadgitlab-ce-a39a4e4509f5272bc5b4001cded198ebd7d98614.tar.gz
Make subgroup_creation_level default to maintainer at SQL level
- Migration updates existing groups to "owner", then sets default to "maintainer" so that new groups will default to that - Update spec examples
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/admin/groups_controller_spec.rb7
-rw-r--r--spec/factories/groups.rb1
-rw-r--r--spec/features/groups/show_spec.rb6
-rw-r--r--spec/requests/api/groups_spec.rb4
4 files changed, 9 insertions, 9 deletions
diff --git a/spec/controllers/admin/groups_controller_spec.rb b/spec/controllers/admin/groups_controller_spec.rb
index 72f389513f8..398f587bafe 100644
--- a/spec/controllers/admin/groups_controller_spec.rb
+++ b/spec/controllers/admin/groups_controller_spec.rb
@@ -70,14 +70,13 @@ describe Admin::GroupsController do
end
it 'updates the subgroup_creation_level successfully' do
- MAINTAINER = ::Gitlab::Access::MAINTAINER_SUBGROUP_ACCESS
+ OWNER = ::Gitlab::Access::OWNER_SUBGROUP_ACCESS
expect do
post :update,
params: { id: group.to_param,
- group: { subgroup_creation_level: MAINTAINER } }
- end.to change { group.reload.subgroup_creation_level }
- .to(MAINTAINER)
+ group: { subgroup_creation_level: OWNER } }
+ end.to change { group.reload.subgroup_creation_level }.to(OWNER)
end
end
end
diff --git a/spec/factories/groups.rb b/spec/factories/groups.rb
index 947392b4fbc..b67ab955ffc 100644
--- a/spec/factories/groups.rb
+++ b/spec/factories/groups.rb
@@ -5,7 +5,6 @@ FactoryBot.define do
type 'Group'
owner nil
project_creation_level ::Gitlab::Access::MAINTAINER_PROJECT_ACCESS
- subgroup_creation_level ::Gitlab::Access::OWNER_SUBGROUP_ACCESS
after(:create) do |group|
if group.owner
diff --git a/spec/features/groups/show_spec.rb b/spec/features/groups/show_spec.rb
index 9cf5e7f9bb6..bed998a0859 100644
--- a/spec/features/groups/show_spec.rb
+++ b/spec/features/groups/show_spec.rb
@@ -78,10 +78,11 @@ describe 'Group show page' do
context 'when subgroups are supported', :nested_groups do
before do
allow(Group).to receive(:supports_nested_objects?) { true }
- visit path
end
it 'allows creating subgroups' do
+ visit path
+
expect(page)
.to have_css("li[data-text='New subgroup']", visible: false)
end
@@ -90,10 +91,11 @@ describe 'Group show page' do
context 'when subgroups are not supported' do
before do
allow(Group).to receive(:supports_nested_objects?) { false }
- visit path
end
it 'does not allow creating subgroups' do
+ visit path
+
expect(page)
.not_to have_selector("li[data-text='New subgroup']", visible: false)
end
diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb
index c41408fba65..52d926d5484 100644
--- a/spec/requests/api/groups_spec.rb
+++ b/spec/requests/api/groups_spec.rb
@@ -803,10 +803,10 @@ describe API::Groups do
group2.add_maintainer(user1)
end
- it 'cannot create subgroups' do
+ it 'can create subgroups' do
post api("/groups", user1), params: { parent_id: group2.id, name: 'foo', path: 'foo' }
- expect(response).to have_gitlab_http_status(403)
+ expect(response).to have_gitlab_http_status(201)
end
end
end