summaryrefslogtreecommitdiff
path: root/spec/classes/ntp_install_spec.rb
blob: 21028783ce7ffdee0f68ec56567b233f5671c427 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
require 'spec_helper'

describe 'ntp::install' do

  ['Debian', 'RedHat', 'SuSE', 'FreeBSD'].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

  describe "for distribution archlinux" do

    let(:facts) {{ :osfamily => 'Linux', :operatingsystem => 'ArchLinux' }}
    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

  end

end