Incorporate review feedback
This commit is contained in:
parent
0ec6134ff9
commit
1819dbd4d1
1 changed files with 9 additions and 9 deletions
|
@ -475,15 +475,14 @@ describe API::Labels do
|
|||
|
||||
describe 'PUT /projects/:id/labels/promote' do
|
||||
let(:group) { create(:group) }
|
||||
let!(:project1) { create(:project, namespace: group) }
|
||||
let!(:label1) { create(:label, title: 'label1', project: project1) }
|
||||
|
||||
before do
|
||||
group.add_owner(user)
|
||||
project.update!(group: group)
|
||||
end
|
||||
|
||||
it 'returns 200 if label is promoted' do
|
||||
put api("/projects/#{project1.id}/labels/promote", user), params: { name: label1.name }
|
||||
put api("/projects/#{project.id}/labels/promote", user), params: { name: label1.name }
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(json_response['name']).to eq(label1.name)
|
||||
|
@ -493,29 +492,30 @@ describe API::Labels do
|
|||
it 'returns 200 if group label already exists' do
|
||||
create(:group_label, title: label1.name, group: group)
|
||||
|
||||
put api("/projects/#{project1.id}/labels/promote", user), params: { name: label1.name }
|
||||
expect { put api("/projects/#{project.id}/labels/promote", user), params: { name: label1.name } }
|
||||
.to change(project.labels, :count).by(-1)
|
||||
.and change(group.labels, :count).by(0)
|
||||
|
||||
expect(response).to have_gitlab_http_status(200)
|
||||
expect(project1.labels.size).to eq(0)
|
||||
end
|
||||
|
||||
it 'returns 403 if guest promotes label' do
|
||||
guest = create(:user)
|
||||
project1.add_guest(guest)
|
||||
project.add_guest(guest)
|
||||
|
||||
put api("/projects/#{project1.id}/labels/promote", guest), params: { name: label1.name }
|
||||
put api("/projects/#{project.id}/labels/promote", guest), params: { name: label1.name }
|
||||
|
||||
expect(response).to have_gitlab_http_status(403)
|
||||
end
|
||||
|
||||
it 'returns 404 if label does not exist' do
|
||||
put api("/projects/#{project1.id}/labels/promote", user), params: { name: 'unknown' }
|
||||
put api("/projects/#{project.id}/labels/promote", user), params: { name: 'unknown' }
|
||||
|
||||
expect(response).to have_gitlab_http_status(404)
|
||||
end
|
||||
|
||||
it 'returns 400 if no label name given' do
|
||||
put api("/projects/#{project1.id}/labels/promote", user)
|
||||
put api("/projects/#{project.id}/labels/promote", user)
|
||||
|
||||
expect(response).to have_gitlab_http_status(400)
|
||||
expect(json_response['error']).to eq('name is missing')
|
||||
|
|
Loading…
Reference in a new issue