require_relative '../../../../spec_helper'

describe 'govuk_elasticsearch', :type => :class do
  describe '#use_mirror' do
    let(:facts) {{
      :kernel      => 'Linux',
      :configdir   => '/woody',
      :package_dir => '/rex',
      :installpath => '/slinky/dog',
      :plugindir   => '/mr/potato/head',
      :plugintool  => 'bopeep',
      :datadir     => '/buzz/lightyear',
    }}

    context 'true (default)' do
      let(:params) {{
        :version => '1.2.3',
      }}

      it { should contain_class('govuk_elasticsearch::repo') }
      it { should contain_class('elasticsearch').with_manage_repo(false) }
    end

    context 'false' do
      let(:params) {{
        :version    => '1.2.3',
        :use_mirror => false,
      }}

      it { should_not contain_class('govuk_elasticsearch::repo') }
      it { should contain_class('elasticsearch').with_manage_repo(true) }
    end
  end
end

require_relative '../../../../spec_helper'

describe 'govuk_elasticsearch', :type => :class do
  describe '#use_mirror' do
    let(:facts) {{
      :kernel => 'Linux',
    }}

    context 'true (default)' do
      let(:params) {{
        :version => '1.2.3',
      }}

      it { should contain_class('govuk_elasticsearch::repo') }
      it { should contain_class('elasticsearch').with_manage_repo(false) }
    end

    context 'false' do
      let(:params) {{
        :version    => '1.2.3',
        :use_mirror => false,
      }}

      it { should_not contain_class('govuk_elasticsearch::repo') }
      it { should contain_class('elasticsearch').with_manage_repo(true) }
    end
  end
end

Remove unnecessary stubbed facts for Elasticsearch
Remove unnecessary stubbed facts for Elasticsearch

The third-party `elasticsearch` module which `govuk_elasticsearch` calls
needs the `Linux` fact to be stubbed so that `elasticsearch::params` can
determine the appropriate user/group for that platform.

The other facts listed in here look like the names of parameters on the
`elasticsearch` class rather than the names of facts (they aren't generic
enough). The tests don't fail without them, so I'm removing them for
clarity.
