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:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-25 12:12:21 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-25 12:12:21 +0300
commit45760607bc053b7379f81edd5ea91dd2a6471522 (patch)
tree3c23388962d7d0eb31fde246718fc91c6acf5c26 /spec/tooling/danger
parent0712a75cc03cb881dc40ae53a50d059822354ad8 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/tooling/danger')
-rw-r--r--spec/tooling/danger/product_intelligence_spec.rb67
-rw-r--r--spec/tooling/danger/project_helper_spec.rb9
2 files changed, 8 insertions, 68 deletions
diff --git a/spec/tooling/danger/product_intelligence_spec.rb b/spec/tooling/danger/product_intelligence_spec.rb
index 5fd44ef5de0..3ba4f062856 100644
--- a/spec/tooling/danger/product_intelligence_spec.rb
+++ b/spec/tooling/danger/product_intelligence_spec.rb
@@ -68,71 +68,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
diff --git a/spec/tooling/danger/project_helper_spec.rb b/spec/tooling/danger/project_helper_spec.rb
index 5edd9e54cc5..ae277c57236 100644
--- a/spec/tooling/danger/project_helper_spec.rb
+++ b/spec/tooling/danger/project_helper_spec.rb
@@ -40,7 +40,7 @@ RSpec.describe Tooling::Danger::ProjectHelper do
using RSpec::Parameterized::TableSyntax
before do
- allow(fake_git).to receive(:diff_for_file).with('usage_data.rb') { double(:diff, patch: "+ count(User.active)") }
+ allow(fake_git).to receive(:diff_for_file).with(instance_of(String)) { double(:diff, patch: "+ count(User.active)") }
end
where(:path, :expected_categories) do
@@ -189,6 +189,10 @@ RSpec.describe Tooling::Danger::ProjectHelper do
'spec/frontend/tracking/foo.js' | [:frontend, :product_intelligence]
'spec/frontend/tracking_spec.js' | [:frontend, :product_intelligence]
'lib/gitlab/usage_database/foo.rb' | [:backend]
+ 'config/metrics/counts_7d/test_metric.yml' | [:product_intelligence]
+ 'config/metrics/schema.json' | [:product_intelligence]
+ 'doc/api/usage_data.md' | [:product_intelligence]
+ 'spec/lib/gitlab/usage_data_spec.rb' | [:product_intelligence]
end
with_them do
@@ -199,6 +203,9 @@ RSpec.describe Tooling::Danger::ProjectHelper do
context 'having specific changes' do
where(:expected_categories, :patch, :changed_files) do
+ [:product_intelligence] | '+data-track-action' | ['components/welcome.vue']
+ [:product_intelligence] | '+ data: { track_label:' | ['admin/groups/_form.html.haml']
+ [:product_intelligence] | '+ Gitlab::Tracking.event' | ['dashboard/todos_controller.rb', 'admin/groups/_form.html.haml']
[:database, :backend, :product_intelligence] | '+ count(User.active)' | ['usage_data.rb', 'lib/gitlab/usage_data.rb', 'ee/lib/ee/gitlab/usage_data.rb']
[:database, :backend, :product_intelligence] | '+ estimate_batch_distinct_count(User.active)' | ['usage_data.rb']
[:backend, :product_intelligence] | '+ alt_usage_data(User.active)' | ['lib/gitlab/usage_data.rb']