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