summaryrefslogtreecommitdiff
path: root/spec/lib/quality
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-17 21:09:16 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-17 21:09:16 +0000
commit154b9bae142ba15fec753f44327654595094b879 (patch)
tree027f8ae024961778d5b00c77a72fe302f985d4f3 /spec/lib/quality
parent2c156e3c7bbade01c36eee18327f1ced6eebea79 (diff)
downloadgitlab-ce-154b9bae142ba15fec753f44327654595094b879.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/quality')
-rw-r--r--spec/lib/quality/test_level_spec.rb40
1 files changed, 38 insertions, 2 deletions
diff --git a/spec/lib/quality/test_level_spec.rb b/spec/lib/quality/test_level_spec.rb
index 34163c6cfbc..6042ab24787 100644
--- a/spec/lib/quality/test_level_spec.rb
+++ b/spec/lib/quality/test_level_spec.rb
@@ -28,7 +28,14 @@ RSpec.describe Quality::TestLevel do
context 'when level is migration' do
it 'returns a pattern' do
expect(subject.pattern(:migration))
- .to eq("spec/{migrations,lib/gitlab/background_migration,lib/ee/gitlab/background_migration}{,/**/}*_spec.rb")
+ .to eq("spec/{migrations}{,/**/}*_spec.rb")
+ end
+ end
+
+ context 'when level is background_migration' do
+ it 'returns a pattern' do
+ expect(subject.pattern(:background_migration))
+ .to eq("spec/{lib/gitlab/background_migration,lib/ee/gitlab/background_migration}{,/**/}*_spec.rb")
end
end
@@ -89,7 +96,14 @@ RSpec.describe Quality::TestLevel do
context 'when level is migration' do
it 'returns a regexp' do
expect(subject.regexp(:migration))
- .to eq(%r{spec/(migrations|lib/gitlab/background_migration|lib/ee/gitlab/background_migration)})
+ .to eq(%r{spec/(migrations)})
+ end
+ end
+
+ context 'when level is background_migration' do
+ it 'returns a regexp' do
+ expect(subject.regexp(:background_migration))
+ .to eq(%r{spec/(lib/gitlab/background_migration|lib/ee/gitlab/background_migration)})
end
end
@@ -160,4 +174,26 @@ RSpec.describe Quality::TestLevel do
%r{Test level for spec/unknown/foo_spec.rb couldn't be set. Please rename the file properly or change the test level detection regexes in .+/lib/quality/test_level.rb.})
end
end
+
+ describe '#background_migration?' do
+ it 'returns false for a unit test' do
+ expect(subject.background_migration?('spec/models/abuse_report_spec.rb')).to be(false)
+ end
+
+ it 'returns true for a migration test' do
+ expect(subject.background_migration?('spec/migrations/add_default_and_free_plans_spec.rb')).to be(false)
+ end
+
+ it 'returns true for a background migration test' do
+ expect(subject.background_migration?('spec/lib/gitlab/background_migration/archive_legacy_traces_spec.rb')).to be(true)
+ end
+
+ it 'returns true for a geo migration test' do
+ expect(described_class.new('ee/').background_migration?('ee/spec/migrations/geo/migrate_ci_job_artifacts_to_separate_registry_spec.rb')).to be(false)
+ end
+
+ it 'returns true for a EE-namespaced background migration test' do
+ expect(described_class.new('ee/').background_migration?('ee/spec/lib/ee/gitlab/background_migration/prune_orphaned_geo_events_spec.rb')).to be(true)
+ end
+ end
end