2019-10-30 08:06:34 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2021-09-23 11:11:29 -04:00
|
|
|
RSpec.describe 'Database config initializer', :reestablished_active_record_base do
|
2019-10-30 08:06:34 -04:00
|
|
|
subject do
|
|
|
|
load Rails.root.join('config/initializers/database_config.rb')
|
|
|
|
end
|
|
|
|
|
2021-08-18 08:11:19 -04:00
|
|
|
it 'retains the correct database name for the connection' do
|
2021-11-15 10:10:57 -05:00
|
|
|
previous_db_name = ApplicationRecord.connection.pool.db_config.name
|
2021-08-18 08:11:19 -04:00
|
|
|
|
|
|
|
subject
|
|
|
|
|
2021-11-15 10:10:57 -05:00
|
|
|
expect(ApplicationRecord.connection.pool.db_config.name).to eq(previous_db_name)
|
2021-08-18 08:11:19 -04:00
|
|
|
end
|
|
|
|
|
2021-11-01 14:12:42 -04:00
|
|
|
it 'does not overwrite custom pool settings' do
|
|
|
|
expect { subject }.not_to change { ActiveRecord::Base.connection_db_config.pool }
|
2020-07-22 17:09:50 -04:00
|
|
|
end
|
2019-10-30 08:06:34 -04:00
|
|
|
end
|