summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-02-09 08:31:43 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-02-09 08:31:43 +0000
commit3d20670058eba11b470bfd318a4842197b3bb122 (patch)
tree686b3485575f82fd5d1835ab64531dcf293571c5 /spec/requests
parent62870a0e50ddbcdb0a0536e5523c17886c8f7022 (diff)
parentdf974814fbbbf8f088f6bb480344cfdfcec6c1b2 (diff)
downloadgitlab-ce-3d20670058eba11b470bfd318a4842197b3bb122.tar.gz
Merge branch 'dz-nested-groups-api' into 'master'
Nested groups API See merge request !9034
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/groups_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb
index a027c23bb88..15592f1f702 100644
--- a/spec/requests/api/groups_spec.rb
+++ b/spec/requests/api/groups_spec.rb
@@ -179,6 +179,7 @@ describe API::Groups, api: true do
expect(json_response['request_access_enabled']).to eq(group1.request_access_enabled)
expect(json_response['full_name']).to eq(group1.full_name)
expect(json_response['full_path']).to eq(group1.full_path)
+ expect(json_response['parent_id']).to eq(group1.parent_id)
expect(json_response['projects']).to be_an Array
expect(json_response['projects'].length).to eq(2)
expect(json_response['shared_projects']).to be_an Array
@@ -398,6 +399,19 @@ describe API::Groups, api: true do
expect(json_response["request_access_enabled"]).to eq(group[:request_access_enabled])
end
+ it "creates a nested group" do
+ parent = create(:group)
+ parent.add_owner(user3)
+ group = attributes_for(:group, { parent_id: parent.id })
+
+ post api("/groups", user3), group
+
+ expect(response).to have_http_status(201)
+
+ expect(json_response["full_path"]).to eq("#{parent.path}/#{group[:path]}")
+ expect(json_response["parent_id"]).to eq(parent.id)
+ end
+
it "does not create group, duplicate" do
post api("/groups", user3), { name: 'Duplicate Test', path: group2.path }