Commit 43cc78c7 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '337982-avoid-removing-pi-approved' into 'master'

Avoid removing PI approved label

See merge request gitlab-org/gitlab!72857
parents d3693b3b 05ae26fe
......@@ -44,20 +44,26 @@ RSpec.describe Tooling::Danger::ProductIntelligence do
context 'with product intelligence label' do
let(:expected_labels) { ['product intelligence::review pending'] }
let(:mr_labels) { [] }
before do
allow(fake_helper).to receive(:mr_has_labels?).with('product intelligence').and_return(true)
allow(fake_helper).to receive(:mr_labels).and_return(mr_labels)
end
it { is_expected.to match_array(expected_labels) }
end
context 'with product intelligence::review pending' do
before do
allow(fake_helper).to receive(:mr_has_labels?).and_return(true)
context 'with product intelligence::review pending' do
let(:mr_labels) { ['product intelligence::review pending'] }
it { is_expected.to be_empty }
end
it { is_expected.to be_empty }
context 'with product intelligence::approved' do
let(:mr_labels) { ['product intelligence::approved'] }
it { is_expected.to be_empty }
end
end
context 'with growth experiment label' do
......
......@@ -14,10 +14,16 @@ module Tooling
labels = []
labels << 'product intelligence' unless helper.mr_has_labels?('product intelligence')
labels << 'product intelligence::review pending' unless helper.mr_has_labels?(WORKFLOW_LABELS)
labels << 'product intelligence::review pending' unless has_workflow_labels?
labels
end
private
def has_workflow_labels?
(WORKFLOW_LABELS & helper.mr_labels).any?
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment