Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-04-13 11:23:29 +0300
committerRémy Coutable <remy@rymai.me>2016-04-13 11:23:29 +0300
commitfc9e1be1fde9646358aab756198c1d3773e55664 (patch)
tree88424a8d0ce1487c911275132c1c089a7f6b3932 /spec/requests/api
parent64d71b4dfc4513b70eac61cbb9bb718aee3f09e9 (diff)
parent5fb572417e0c331afb62c8bbaa561b0fe7836fc5 (diff)
Merge branch 'api-group-visibility' into 'master'
API: Ability to update a group This makes it much easier to update a group after introducing the group visibility. * Closes #14991 See merge request !3587
Diffstat (limited to 'spec/requests/api')
-rw-r--r--spec/requests/api/groups_spec.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb
index 41c9cacd455..7383c7d11aa 100644
--- a/spec/requests/api/groups_spec.rb
+++ b/spec/requests/api/groups_spec.rb
@@ -97,6 +97,50 @@ describe API::API, api: true do
end
end
+ describe 'PUT /groups/:id' do
+ let(:new_group_name) { 'New Group'}
+
+ context 'when authenticated as the group owner' do
+ it 'updates the group' do
+ put api("/groups/#{group1.id}", user1), name: new_group_name
+
+ expect(response.status).to eq(200)
+ expect(json_response['name']).to eq(new_group_name)
+ end
+
+ it 'returns 404 for a non existing group' do
+ put api('/groups/1328', user1)
+
+ expect(response.status).to eq(404)
+ end
+ end
+
+ context 'when authenticated as the admin' do
+ it 'updates the group' do
+ put api("/groups/#{group1.id}", admin), name: new_group_name
+
+ expect(response.status).to eq(200)
+ expect(json_response['name']).to eq(new_group_name)
+ end
+ end
+
+ context 'when authenticated as an user that can see the group' do
+ it 'does not updates the group' do
+ put api("/groups/#{group1.id}", user2), name: new_group_name
+
+ expect(response.status).to eq(403)
+ end
+ end
+
+ context 'when authenticated as an user that cannot see the group' do
+ it 'returns 403 when trying to update the group' do
+ put api("/groups/#{group2.id}", user1), name: new_group_name
+
+ expect(response.status).to eq(403)
+ end
+ end
+ end
+
describe "GET /groups/:id/projects" do
context "when authenticated as user" do
it "should return the group's projects" do