From 6438df3a1e0fb944485cebf07976160184697d72 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Wed, 20 Jan 2021 13:34:23 -0600 Subject: Add latest changes from gitlab-org/gitlab@13-8-stable-ee --- spec/requests/api/labels_spec.rb | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'spec/requests/api/labels_spec.rb') diff --git a/spec/requests/api/labels_spec.rb b/spec/requests/api/labels_spec.rb index b368f6e329c..6db6de4b533 100644 --- a/spec/requests/api/labels_spec.rb +++ b/spec/requests/api/labels_spec.rb @@ -520,14 +520,29 @@ RSpec.describe API::Labels do expect(json_response['color']).to eq(label1.color) end - it 'returns 200 if group label already exists' do - create(:group_label, title: label1.name, group: group) + context 'if group label already exists' do + let!(:group_label) { create(:group_label, title: label1.name, group: group) } - 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) + it 'returns a status of 200' do + put api("/projects/#{project.id}/labels/promote", user), params: { name: label1.name } - expect(response).to have_gitlab_http_status(:ok) + expect(response).to have_gitlab_http_status(:ok) + end + + it 'does not change the group label count' do + expect { put api("/projects/#{project.id}/labels/promote", user), params: { name: label1.name } } + .not_to change(group.labels, :count) + end + + it 'does not change the group label max (reuses the same ID)' do + expect { put api("/projects/#{project.id}/labels/promote", user), params: { name: label1.name } } + .not_to change(group.labels, :max) + end + + it 'changes the project label count' do + expect { put api("/projects/#{project.id}/labels/promote", user), params: { name: label1.name } } + .to change(project.labels, :count).by(-1) + end end it 'returns 403 if guest promotes label' do -- cgit v1.2.1