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:
authorRobert Speicher <rspeicher@gmail.com>2021-01-20 22:34:23 +0300
committerRobert Speicher <rspeicher@gmail.com>2021-01-20 22:34:23 +0300
commit6438df3a1e0fb944485cebf07976160184697d72 (patch)
tree00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /spec/requests/api/labels_spec.rb
parent42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff)
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'spec/requests/api/labels_spec.rb')
-rw-r--r--spec/requests/api/labels_spec.rb27
1 files changed, 21 insertions, 6 deletions
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