summaryrefslogtreecommitdiff
path: root/spec/classes/ntp_install_spec.rb
blob: 4ed263ed22e579ad6202bf407ad57c6624a8306c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
require 'spec_helper'

describe 'ntp::install' do

  ['Debian', 'RedHat', 'SuSE', 'FreeBSD', 'Archlinux'].each do |osfamily|
    describe "for osfamily #{osfamily}" do

      let(:facts) {{ :osfamily => osfamily }}
      let(:params) {{
        :package_ensure => 'present',
        :package_name   => 'ntp',
      }}

      it { should contain_package('ntp').with(
        :ensure => 'present',
        :name   => 'ntp'
      )}

      it 'should allow package ensure to be overridden' do
        params[:package_ensure] = 'latest'
        subject.should contain_package('ntp').with_ensure('latest')
      end

      it 'should allow the package name to be overridden' do
        params[:package_name] = 'hambaby'
        subject.should contain_package('ntp').with_name('hambaby')
      end

    end
  end

  describe "for distribution gentoo" do

    let(:facts) {{ :osfamily => 'Linux', :operatingsystem => 'Gentoo' }}
    let(:params) {{
      :package_ensure => 'present',
      :package_name   => 'net-misc/ntp',
    }}

    it { should contain_package('ntp').with(
      :ensure => 'present',
      :name   => 'net-misc/ntp'
    )}

    it 'should allow package ensure to be overridden' do
      params[:package_ensure] = 'latest'
      subject.should contain_package('ntp').with_ensure('latest')
    end

  end

end