debian-mirror-gitlab/spec/initializers/database_config_spec.rb

22 lines
611 B
Ruby
Raw Normal View History

2019-12-26 22:10:19 +05:30
# frozen_string_literal: true
require 'spec_helper'
2021-11-18 22:05:49 +05:30
RSpec.describe 'Database config initializer', :reestablished_active_record_base do
2019-12-26 22:10:19 +05:30
subject do
load Rails.root.join('config/initializers/database_config.rb')
end
2021-10-27 15:23:28 +05:30
it 'retains the correct database name for the connection' do
2021-12-11 22:18:48 +05:30
previous_db_name = ApplicationRecord.connection.pool.db_config.name
2019-12-26 22:10:19 +05:30
2021-10-27 15:23:28 +05:30
subject
2021-09-04 01:27:46 +05:30
2021-12-11 22:18:48 +05:30
expect(ApplicationRecord.connection.pool.db_config.name).to eq(previous_db_name)
2020-10-24 23:57:45 +05:30
end
2019-12-26 22:10:19 +05:30
2021-12-11 22:18:48 +05:30
it 'does not overwrite custom pool settings' do
expect { subject }.not_to change { ActiveRecord::Base.connection_db_config.pool }
2019-12-26 22:10:19 +05:30
end
end