diff options
Diffstat (limited to 'spec/tooling/danger/product_intelligence_spec.rb')
-rw-r--r-- | spec/tooling/danger/product_intelligence_spec.rb | 83 |
1 files changed, 11 insertions, 72 deletions
diff --git a/spec/tooling/danger/product_intelligence_spec.rb b/spec/tooling/danger/product_intelligence_spec.rb index 5fd44ef5de0..c090dbb4de4 100644 --- a/spec/tooling/danger/product_intelligence_spec.rb +++ b/spec/tooling/danger/product_intelligence_spec.rb @@ -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 @@ -68,71 +74,4 @@ RSpec.describe Tooling::Danger::ProductIntelligence do it { is_expected.to be_empty } end end - - describe '#matching_changed_files' do - subject { product_intelligence.matching_changed_files } - - let(:changed_files) do - [ - 'dashboard/todos_controller.rb', - 'components/welcome.vue', - 'admin/groups/_form.html.haml' - ] - end - - context 'with snowplow files changed' do - context 'when vue file changed' do - let(:changed_lines) { ['+data-track-action'] } - - it { is_expected.to match_array(['components/welcome.vue']) } - end - - context 'when haml file changed' do - let(:changed_lines) { ['+ data: { track_label:'] } - - it { is_expected.to match_array(['admin/groups/_form.html.haml']) } - end - - context 'when ruby file changed' do - let(:changed_lines) { ['+ Gitlab::Tracking.event'] } - let(:changed_files) { ['dashboard/todos_controller.rb', 'admin/groups/_form.html.haml'] } - - it { is_expected.to match_array(['dashboard/todos_controller.rb']) } - end - end - - context 'with metrics files changed' do - let(:changed_files) { ['config/metrics/counts_7d/test_metric.yml', 'ee/config/metrics/counts_7d/ee_metric.yml'] } - - it { is_expected.to match_array(changed_files) } - end - - context 'with metrics files not changed' do - it { is_expected.to be_empty } - end - - context 'with tracking files changed' do - let(:changed_files) do - [ - 'lib/gitlab/tracking.rb', - 'spec/lib/gitlab/tracking_spec.rb', - 'app/helpers/tracking_helper.rb' - ] - end - - it { is_expected.to match_array(changed_files) } - end - - context 'with usage_data files changed' do - let(:changed_files) do - [ - 'doc/api/usage_data.md', - 'ee/lib/ee/gitlab/usage_data.rb', - 'spec/lib/gitlab/usage_data_spec.rb' - ] - end - - it { is_expected.to match_array(changed_files) } - end - end end |