diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-24 18:11:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-24 18:11:29 +0300 |
commit | cb9b55e662d4164d913ef7031adc135d3ea4d9f0 (patch) | |
tree | 0da3d639eb5f981cc73f3c72648351e56fedd971 /spec/support/database | |
parent | d5f67e75b6ef8ebc1b304589005ccd91ea6674ff (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/database')
-rw-r--r-- | spec/support/database/multiple_databases.rb | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/spec/support/database/multiple_databases.rb b/spec/support/database/multiple_databases.rb index b863767b5df..b6341c2caec 100644 --- a/spec/support/database/multiple_databases.rb +++ b/spec/support/database/multiple_databases.rb @@ -2,15 +2,6 @@ module Database module MultipleDatabases - def run_and_cleanup(example) - # Each example may call `migrate!`, so we must ensure we are migrated down every time - schema_migrate_down! - - example.run - - delete_from_all_tables!(except: deletion_except_tables) - end - def skip_if_multiple_databases_not_setup skip 'Skipping because multiple databases not set up' unless Gitlab::Database.has_config?(:ci) end @@ -40,10 +31,15 @@ module Database config_model: base_model ) - schema_migrate_up! delete_from_all_tables!(except: deletion_except_tables) + schema_migrate_up! end end + + # ActiveRecord::Base.clear_all_connections! disconnects and clears attribute methods + # Force a refresh to avoid schema failures. + reset_column_in_all_models + refresh_attribute_methods end # The usage of this method switches temporarily used `connection_handler` @@ -152,10 +148,10 @@ RSpec.configure do |config| config_model: base_model ) - run_and_cleanup(example) + example.run end else - run_and_cleanup(example) + example.run end self.class.use_transactional_tests = true |