Connect to the DB at the bottom of AR::TestCase class definition

This commit is contained in:
Akira Matsuda 2023-01-01 18:00:33 +09:00
parent 4ba87aae1f
commit 946bc94e82
No known key found for this signature in database
2 changed files with 5 additions and 6 deletions

View File

@ -11,9 +11,6 @@ require "active_support/logger"
require "active_support/core_ext/kernel/reporting" require "active_support/core_ext/kernel/reporting"
require "active_support/core_ext/kernel/singleton_class" require "active_support/core_ext/kernel/singleton_class"
require "support/config"
require "support/connection"
# TODO: Move all these random hacks into the ARTest namespace and into the support/ dir # TODO: Move all these random hacks into the ARTest namespace and into the support/ dir
Thread.abort_on_exception = true Thread.abort_on_exception = true
@ -24,9 +21,6 @@ ActiveRecord.deprecator.debug = true
# Disable available locale checks to avoid warnings running the test suite. # Disable available locale checks to avoid warnings running the test suite.
I18n.enforce_available_locales = false I18n.enforce_available_locales = false
# Connect to the database
ARTest.connect
# Quote "type" if it's a reserved word for the current connection. # Quote "type" if it's a reserved word for the current connection.
QUOTED_TYPE = ActiveRecord::Base.connection.quote_column_name("type") QUOTED_TYPE = ActiveRecord::Base.connection.quote_column_name("type")

View File

@ -8,6 +8,8 @@ require "active_support/testing/stream"
require "active_record/fixtures" require "active_record/fixtures"
require "cases/validations_repair_helper" require "cases/validations_repair_helper"
require_relative "../support/config"
require_relative "../support/connection"
require_relative "../support/adapter_helper" require_relative "../support/adapter_helper"
module ActiveRecord module ActiveRecord
@ -220,6 +222,9 @@ module ActiveRecord
end end
end end
end end
# Connect to the database
ARTest.connect
end end
class PostgreSQLTestCase < TestCase class PostgreSQLTestCase < TestCase