view modules/apache/spec/unit/apache_version_spec.rb @ 260:5f63afb70415

Fix naming of files for new VPS overrides $hostname is just the short host name, not the FQDN
author IBBoard <dev@ibboard.co.uk>
date Sun, 29 Dec 2019 10:57:18 -0500
parents 675c1cc61eaf
children d9352a684e62
line wrap: on
line source

require 'spec_helper'

describe Facter::Util::Fact do
  before do
    Facter.clear
  end

  describe 'apache_version' do
    context 'with value' do
      before :each do
        expect(Facter::Util::Resolution).to receive(:which).with('apachectl') { true }
        expect(Facter::Util::Resolution).to receive(:exec).with('apachectl -v 2>&1') {'Server version: Apache/2.4.16 (Unix)
                                                                                  Server built:   Jul 31 2015 15:53:26'}
      end
      it do
        expect(Facter.fact(:apache_version).value).to eq('2.4.16')
      end
    end
  end

  describe 'apache_version with empty OS' do
    context 'with value' do
      before :each do
        expect(Facter::Util::Resolution).to receive(:which).with('apachectl') { true }
        expect(Facter::Util::Resolution).to receive(:exec).with('apachectl -v 2>&1') {'Server version: Apache/2.4.6 ()
                                                                                  Server built:   Nov 21 2015 05:34:59' }
      end
      it do
        expect(Facter.fact(:apache_version).value).to eq('2.4.6')
      end
    end
  end
end