Welcome to mirror list, hosted at ThFree Co, Russian Federation.

database_config_spec.rb « initializers « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 230f12967603e66074b634ef4023770e8151706e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Database config initializer', :reestablished_active_record_base do
  subject do
    load Rails.root.join('config/initializers/database_config.rb')
  end

  it 'retains the correct database name for the connection' do
    previous_db_name = ApplicationRecord.connection.pool.db_config.name

    subject

    expect(ApplicationRecord.connection.pool.db_config.name).to eq(previous_db_name)
  end

  it 'does not overwrite custom pool settings' do
    expect { subject }.not_to change { ActiveRecord::Base.connection_db_config.pool }
  end
end