diff options
author | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
commit | 6438df3a1e0fb944485cebf07976160184697d72 (patch) | |
tree | 00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /spec/requests/api/labels_spec.rb | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) | |
download | gitlab-ce-6438df3a1e0fb944485cebf07976160184697d72.tar.gz |
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.rb | 27 |
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 |