summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-09-10 15:11:12 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-09-10 15:11:12 +0000
commit6a6824a5ce46273248944d1859591d3a811aa18e (patch)
tree77cc4f04ff7d59fc518fba04e3a226dc0949ed37 /spec/support
parent8fd149139d3d64b102f51455180f03adbc80f469 (diff)
downloadgitlab-ce-6a6824a5ce46273248944d1859591d3a811aa18e.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/database_cleaner.rb4
-rw-r--r--spec/support/db_cleaner.rb2
-rw-r--r--spec/support/helpers/test_env.rb4
-rw-r--r--spec/support/shared_examples/services/incident_shared_examples.rb2
-rw-r--r--spec/support/shared_examples/work_item_base_types_importer.rb3
5 files changed, 12 insertions, 3 deletions
diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rb
index 01bf390d9e9..b31881e3082 100644
--- a/spec/support/database_cleaner.rb
+++ b/spec/support/database_cleaner.rb
@@ -14,7 +14,7 @@ RSpec.configure do |config|
end
config.append_after(:context, :migration) do
- delete_from_all_tables!
+ delete_from_all_tables!(except: ['work_item_types'])
# Postgres maximum number of columns in a table is 1600 (https://github.com/postgres/postgres/blob/de41869b64d57160f58852eab20a27f248188135/src/include/access/htup_details.h#L23-L47).
# And since:
@@ -61,7 +61,7 @@ RSpec.configure do |config|
example.run
- delete_from_all_tables!
+ delete_from_all_tables!(except: ['work_item_types'])
self.class.use_transactional_tests = true
end
diff --git a/spec/support/db_cleaner.rb b/spec/support/db_cleaner.rb
index 155dc3c17d9..940ff2751d3 100644
--- a/spec/support/db_cleaner.rb
+++ b/spec/support/db_cleaner.rb
@@ -12,7 +12,7 @@ module DbCleaner
end
def deletion_except_tables
- []
+ ['work_item_types']
end
def setup_database_cleaner
diff --git a/spec/support/helpers/test_env.rb b/spec/support/helpers/test_env.rb
index aa5fcf222f2..badd4e8212c 100644
--- a/spec/support/helpers/test_env.rb
+++ b/spec/support/helpers/test_env.rb
@@ -452,6 +452,10 @@ module TestEnv
example_group
end
+ def seed_db
+ Gitlab::DatabaseImporters::WorkItems::BaseTypeImporter.import
+ end
+
private
# These are directories that should be preserved at cleanup time
diff --git a/spec/support/shared_examples/services/incident_shared_examples.rb b/spec/support/shared_examples/services/incident_shared_examples.rb
index 9fced12b543..0277cce975a 100644
--- a/spec/support/shared_examples/services/incident_shared_examples.rb
+++ b/spec/support/shared_examples/services/incident_shared_examples.rb
@@ -13,6 +13,7 @@
RSpec.shared_examples 'incident issue' do
it 'has incident as issue type' do
expect(issue.issue_type).to eq('incident')
+ expect(issue.work_item_type.base_type).to eq('incident')
end
end
@@ -41,6 +42,7 @@ RSpec.shared_examples 'not an incident issue' do
it 'has not incident as issue type' do
expect(issue.issue_type).not_to eq('incident')
+ expect(issue.work_item_type.base_type).not_to eq('incident')
end
it 'has not an incident label' do
diff --git a/spec/support/shared_examples/work_item_base_types_importer.rb b/spec/support/shared_examples/work_item_base_types_importer.rb
index 2c02b76d49b..7d652be8d05 100644
--- a/spec/support/shared_examples/work_item_base_types_importer.rb
+++ b/spec/support/shared_examples/work_item_base_types_importer.rb
@@ -2,6 +2,9 @@
RSpec.shared_examples 'work item base types importer' do
it 'creates all base work item types' do
+ # Fixtures need to run on a pristine DB, but the test suite preloads the base types before(:suite)
+ WorkItem::Type.delete_all
+
expect { subject }.to change(WorkItem::Type, :count).from(0).to(WorkItem::Type::BASE_TYPES.count)
end
end