<commit_before>require 'chef_helper'

describe 'postgresql' do
  let(:chef_run) { ChefSpec::SoloRunner.converge('gitlab::default') }

  before { allow(Gitlab).to receive(:[]).and_call_original }

  context 'when shared_preload_libraries is nil' do
    before do
      stub_gitlab_rb(
        "postgresql" => { shared_preload_libraries: nil}
      )
    end

    it 'correctly sets the shared_preload_libraries setting' do
      expect(chef_run.node['gitlab']['postgresql']['shared_preload_libraries'])
        .to be_nil
    end

  end

  context 'when shared_preload_libraries is pg_stat_statements' do
    before do
      stub_gitlab_rb(
        "postgresql" => { shared_preload_libraries: 'pg_stat_statements'}
      )
    end

    it 'correctly sets the shared_preload_libraries setting' do
      expect(chef_run.node['gitlab']['postgresql']['shared_preload_libraries'])
        .to eql('pg_stat_statements')
    end

  end

end<commit_msg>fixed postgresql spec<commit_after>require 'chef_helper'

describe 'postgresql' do
  let(:chef_run) { ChefSpec::SoloRunner.converge('gitlab::default') }

  before { allow(Gitlab).to receive(:[]).and_call_original }

  context 'when shared_preload_libraries is not configured' do
    it 'correctly sets the shared_preload_libraries default setting' do
      expect(chef_run.node['gitlab']['postgresql']['shared_preload_libraries'])
        .to be_nil
    end
  end

  context 'when shared_preload_libraries is pg_stat_statements' do
    before do
      stub_gitlab_rb(
        "postgresql" => { shared_preload_libraries: 'pg_stat_statements'}
      )
    end

    it 'correctly sets the shared_preload_libraries setting' do
      expect(chef_run.node['gitlab']['postgresql']['shared_preload_libraries'])
        .to eql('pg_stat_statements')
    end
  end
end
{'fraction_non_alphanumeric': 0.10155382907880134, 'fraction_numerical': 0.0, 'mean_word_length': 4.022284122562674, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2824943', 'n_tokens_mistral': 613, 'n_tokens_neox': 592, 'n_words': 118}