Enable Database Cleaner for Geo database when database file is available

parent 2785b205
class Geo::BaseRegistry < ActiveRecord::Base
self.abstract_class = true
if Gitlab::Geo.secondary? || Rails.env.test?
if Gitlab::Geo.secondary? || (Rails.env.test? && Rails.configuration.respond_to?(:geo_database))
establish_connection Rails.configuration.geo_database
end
end
......@@ -30,7 +30,10 @@ RSpec.configure do |config|
end
def setup_database_cleaner
DatabaseCleaner[:active_record, { connection: Geo::BaseRegistry }]
if Rails.configuration.respond_to?(:geo_database)
DatabaseCleaner[:active_record, { connection: Geo::BaseRegistry }]
end
DatabaseCleaner[:active_record, { connection: ActiveRecord::Base }]
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment