summaryrefslogtreecommitdiff
path: root/spec/classes/munin_host_spec.rb
blob: df002cecc3646f4f5dea77acf54b719c5d314f08 (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
require 'spec_helper'

describe 'munin::host' do
  shared_examples 'debian-host' do |os, codename|
    let(:facts) {{
      :operatingsystem => os,
      :osfamily => 'Debian',
      :lsbdistcodename => codename,
      :concat_basedir => '/var/lib/puppet/concat',
    }}
    it { should contain_package('munin') }
    it { should contain_file('/etc/munin/munin.conf') }
    it { should contain_class('munin::host') }
  end

  shared_examples 'redhat-host' do |os, codename|
    let(:facts) {{
      :operatingsystem => os,
      :osfamily => 'RedHat',
      :lsbdistcodename => codename,
      :concat_basedir => '/var/lib/puppet/concat',
    }}
    it { should contain_package('munin') }
    it { should contain_file('/etc/munin/munin.conf') }
    it { should contain_class('munin::host') }
  end

  context 'on debian-like system' do
    it_behaves_like 'debian-host', 'Debian', 'squeeze'
    it_behaves_like 'debian-host', 'Debian', 'wheezy'
    it_behaves_like 'debian-host', 'Ubuntu', 'precise'
  end

  context 'on redhat-like system' do
    it_behaves_like 'redhat-host', 'CentOS', '6'
  end
  
  context 'on Gentoo' do
    let(:facts) {{
      :osfamily => 'Gentoo',
      :concat_basedir => '/var/lib/puppet/concat',
    }}
    it { should contain_package('munin') }
    it { should contain_file('/etc/munin/munin.conf') }
    it { should contain_class('munin::host') }
  end
end