<commit_before>require 'spec_helper'

describe 'letsencrypt::install' do
  let(:params) { default_params.merge(additional_params) }
  let(:default_params) do
    {
      configure_epel: false,
      package_ensure: 'installed',
      manage_install: true,
      manage_dependencies: true,
      path: '/opt/letsencrypt',
      repo: 'https://github.com/letsencrypt/letsencrypt.git',
      version: 'v0.4.2',
    }
  end
  let(:additional_params) { { } }

  describe 'with install_method => package' do
    let(:additional_params) { { install_method: 'package' } }

    it { is_expected.to compile }

    it 'should contain the correct resources' do
      is_expected.not_to contain_vcsrepo('/opt/letsencrypt')
      is_expected.not_to contain_package('python')
      is_expected.not_to contain_package('git')

      is_expected.to contain_package('letsencrypt').with_ensure('installed')
    end

    describe 'with configure_epel => true' do
      let(:additional_params) { { install_method: 'package', configure_epel: true } }

      it { is_expected.to compile }

      it 'should contain the correct resources' do
        is_expected.to contain_class('epel')
        is_expected.to contain_package('letsencrypt').that_requires('Class[epel]')
      end
    end

    describe 'with package_ensure => 0.3.0-1.el7' do
      let(:additional_params) { { install_method: 'package', package_ensure: '0.3.0-1.el7' } }

      it { is_expected.to compile }
      it { is_expected.to contain_package('letsencrypt').with_ensure('0.3.0-1.el7') }
    end
  end

  describe 'with install_method => vcs' do
    let(:additional_params) { { install_method: 'vcs' } }

    it { is_expected.to compile }

    it 'should contain the correct resources' do
      is_expected.to contain_vcsrepo('/opt/letsencrypt').with({<commit_msg>Fixing test failures when STRICT_VARIABLES is set to true<commit_after>require 'spec_helper'

describe 'letsencrypt::install' do
  let(:params) { default_params.merge(additional_params) }
  let(:default_params) do
    {
      configure_epel: false,
      package_ensure: 'installed',
      manage_install: true,
      manage_dependencies: true,
      path: '/opt/letsencrypt',
      repo: 'https://github.com/letsencrypt/letsencrypt.git',
      version: 'v0.4.2',
    }
  end
  let(:additional_params) { { } }

  describe 'with install_method => package' do
    let(:additional_params) { { install_method: 'package' } }

    it { is_expected.to compile }

    it 'should contain the correct resources' do
      is_expected.not_to contain_vcsrepo('/opt/letsencrypt')
      is_expected.not_to contain_package('python')
      is_expected.not_to contain_package('git')

      is_expected.to contain_package('letsencrypt').with_ensure('installed')
    end

    describe 'with configure_epel => true' do
      let(:facts) { { operatingsystemrelease: '7.0.1406', operatingsystemmajrelease: '7' } }
      let(:additional_params) { { install_method: 'package', configure_epel: true } }

      it { is_expected.to compile }

      it 'should contain the correct resources' do
        is_expected.to contain_class('epel')
        is_expected.to contain_package('letsencrypt').that_requires('Class[epel]')
      end
    end

    describe 'with package_ensure => 0.3.0-1.el7' do
      let(:additional_params) { { install_method: 'package', package_ensure: '0.3.0-1.el7' } }

      it { is_expected.to compile }
      it { is_expected.to contain_package('letsencrypt').with_ensure('0.3.0-1.el7') }
    end
  end

  describe 'with install_method => vcs' do
    let(:additional_params) { { install_method: 'vcs' } }

    it { is_expected.to compile }

    it 'should contain the correct resources' do
      is_expected.to contain_vcsrepo('/opt/letsencrypt').with({
{'fraction_non_alphanumeric': 0.12130885873902633, 'fraction_numerical': 0.011439212556530992, 'mean_word_length': 3.4976076555023923, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 2, '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': '4726654', 'n_tokens_mistral': 1234, 'n_tokens_neox': 1181, 'n_words': 244}