summaryrefslogtreecommitdiff
path: root/spec/lib/quality
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-02 21:06:51 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-02 21:06:51 +0000
commita19a376bf35b2009566e86b8190662c21ed7e2ba (patch)
tree46d3ea7f44a0a732b96fcbae0cf09d3cfd8ec9dc /spec/lib/quality
parent556c79d6cc3d7b24ecbba3a79f8432eb3fcf5c7e (diff)
downloadgitlab-ce-a19a376bf35b2009566e86b8190662c21ed7e2ba.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.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/lib/quality/test_level_spec.rb b/spec/lib/quality/test_level_spec.rb
index 4db188bd8f2..c85994402dd 100644
--- a/spec/lib/quality/test_level_spec.rb
+++ b/spec/lib/quality/test_level_spec.rb
@@ -25,6 +25,13 @@ RSpec.describe Quality::TestLevel do
end
end
+ context 'when level is migration' do
+ it 'returns a pattern' do
+ expect(subject.pattern(:migration))
+ .to eq("spec/{migrations,lib/gitlab/background_migration}{,/**/}*_spec.rb")
+ end
+ end
+
context 'when level is integration' do
it 'returns a pattern' do
expect(subject.pattern(:integration))
@@ -79,6 +86,13 @@ RSpec.describe Quality::TestLevel do
end
end
+ context 'when level is migration' do
+ it 'returns a regexp' do
+ expect(subject.regexp(:migration))
+ .to eq(%r{spec/(migrations|lib/gitlab/background_migration)})
+ end
+ end
+
context 'when level is integration' do
it 'returns a regexp' do
expect(subject.regexp(:integration))
@@ -116,6 +130,18 @@ RSpec.describe Quality::TestLevel do
expect(subject.level_for('spec/models/abuse_report_spec.rb')).to eq(:unit)
end
+ it 'returns the correct level for a migration test' do
+ expect(subject.level_for('spec/migrations/add_default_and_free_plans_spec.rb')).to eq(:migration)
+ end
+
+ it 'returns the correct level for a background_migration test' do
+ expect(subject.level_for('spec/lib/gitlab/background_migration/archive_legacy_traces_spec.rb')).to eq(:migration)
+ end
+
+ it 'returns the correct level for a geo migration test' do
+ expect(described_class.new('ee/').level_for('ee/spec/migrations/geo/migrate_ci_job_artifacts_to_separate_registry_spec.rb')).to eq(:migration)
+ end
+
it 'returns the correct level for an integration test' do
expect(subject.level_for('spec/mailers/abuse_report_mailer_spec.rb')).to eq(:integration)
end