Skip to content
代码片段 群组 项目
提交 cafdd925 编辑于 作者: Jonas Larsen's avatar Jonas Larsen 提交者: David Dieulivol
浏览文件

Product Intelligence check also looks at deleted files

Product Intelligence would like to review MRs which removes
metrics or other files that related to Product Intelligence.
上级 f843d3bc
无相关合并请求
......@@ -32,10 +32,12 @@
let(:approved_label) { 'product intelligence::approved' }
let(:changed_files) { ['metrics/counts_7d/test_metric.yml'] }
let(:changed_lines) { ['+tier: ee'] }
let(:fake_changes) { instance_double(Gitlab::Dangerfiles::Changes, files: changed_files) }
before do
allow(fake_changes).to receive(:by_category).with(:product_intelligence).and_return(fake_changes)
allow(fake_helper).to receive(:changes).and_return(fake_changes)
allow(fake_helper).to receive(:all_changed_files).and_return(changed_files)
allow(fake_helper).to receive(:changes_by_category).and_return(product_intelligence: changed_files, database: ['other_files.yml'])
allow(fake_helper).to receive(:markdown_list).with(changed_files).and_return(markdown_formatted_list)
end
......@@ -61,6 +63,15 @@
expect(labels_to_add).to match_array [previous_label_to_add, review_pending_label]
end
it 'receives all the changed files by calling the correct helper method', :aggregate_failures do
expect(fake_helper).not_to receive(:changes_by_category)
expect(fake_helper).to receive(:changes)
expect(fake_changes).to receive(:by_category).with(:product_intelligence)
expect(fake_changes).to receive(:files)
subject
end
end
context 'with growth experiment label' do
......
......@@ -33,8 +33,8 @@ module ProductIntelligence
].freeze
def check!
# exit if not matching files or if no product intelligence labels
product_intelligence_paths_to_review = helper.changes_by_category[:product_intelligence]
product_intelligence_paths_to_review = helper.changes.by_category(:product_intelligence).files
labels_to_add = missing_labels
return if product_intelligence_paths_to_review.empty? || skip_review?
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册