Skip to content
Snippets Groups Projects
Commit 5fb57241 authored by Robert Schilling's avatar Robert Schilling
Browse files

Fix minor issues according development guidelines

parent d0cdc2ee
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -140,7 +140,7 @@ PUT /groups/:id
| `name` | string | no | The name of the group |
| `path` | string | no | The path of the group |
| `description` | string | no | The description of the group |
| `visibility_level` | integer | no | The visibility_level of the group. 0 for private, 10 for internal, 20 for public. |
| `visibility_level` | integer | no | The visibility level of the group. 0 for private, 10 for internal, 20 for public. |
```bash
curl -X PUT -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/groups/5?name=Experimental"
Loading
Loading
Loading
Loading
@@ -47,7 +47,7 @@ module API
# Update group. Available only for users who can administrate groups.
#
# Parameters:
# id (required) - The ID of a group
# id (required) - The ID of a group
# path (optional) - The path of the group
# description (optional) - The description of the group
# visibility_level (optional) - The visibility level of the group
Loading
Loading
@@ -59,12 +59,10 @@ module API
 
attrs = attributes_for_keys [:name, :path, :description, :visibility_level]
 
::Groups::UpdateService.new(group, current_user, attrs).execute
if group.errors.any?
render_validation_error!(group)
else
if ::Groups::UpdateService.new(group, current_user, attrs).execute
present group, with: Entities::GroupDetail
else
render_validation_error!(group)
end
end
 
Loading
Loading
Loading
Loading
@@ -100,7 +100,7 @@ describe API::API, api: true do
describe 'PUT /groups/:id' do
let(:new_group_name) { 'New Group'}
 
context "when authenticated the group owner" do
context 'when authenticated as the group owner' do
it 'updates the group' do
put api("/groups/#{group1.id}", user1), name: new_group_name
 
Loading
Loading
@@ -115,7 +115,7 @@ describe API::API, api: true do
end
end
 
context "when authenticated the admin" do
context 'when authenticated as the admin' do
it 'updates the group' do
put api("/groups/#{group1.id}", admin), name: new_group_name
 
Loading
Loading
@@ -124,13 +124,21 @@ describe API::API, api: true do
end
end
 
context "when authenticated an user" do
it 'updates the group' do
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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment