summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2016-04-07 10:12:49 +0200
committerRobert Schilling <rschilling@student.tugraz.at>2016-04-12 15:47:20 +0200
commitd0cdc2ee73c8421906fbd011d0f44d638616a864 (patch)
tree3635d611380410b44643ec15e2206ce65e4f381d /spec
parent734df1bb504aedec6a5668567de808b549a84749 (diff)
downloadgitlab-ce-d0cdc2ee73c8421906fbd011d0f44d638616a864.tar.gz
API: Ability to update a group
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/api/groups_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb
index 41c9cacd455..e7ccbff7ae2 100644
--- a/spec/requests/api/groups_spec.rb
+++ b/spec/requests/api/groups_spec.rb
@@ -97,6 +97,42 @@ describe API::API, api: true do
end
end
+ describe 'PUT /groups/:id' do
+ let(:new_group_name) { 'New Group'}
+
+ context "when authenticated 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 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 an user" do
+ it 'updates the group' do
+ put api("/groups/#{group1.id}", user2), 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