summaryrefslogtreecommitdiff
path: root/spec/defines/munin_plugin_spec.rb
blob: 3d7e9e3b3f5edd9dfee859e4369441f7fd03bb4b (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
require 'spec_helper'

describe 'munin::plugin' do
  let(:title) { 'users' }
  let(:facts) do
    { :operatingsystem => 'CentOS' }
  end
  context 'present' do
    it { should contain_file('/etc/munin/plugins/users').with(
      :ensure => 'link',
      :target => '/usr/share/munin/plugins/users'
    ) }
    it { should_not contain_file('/etc/munin/plugin-conf.d/users.conf') }
  end

  context 'present and config' do
    let(:params) do
      { :config => 'env.user root' }
    end
    it { should contain_file('/etc/munin/plugins/users').with(
      :ensure  => 'link',
      :target  => '/usr/share/munin/plugins/users',
      :notify  => 'Service[munin-node]'
    ) }
    it { should contain_file('/etc/munin/plugin-conf.d/users.conf').with(
      :content => "[users]\nenv.user root\n",
      :owner   => 'root',
      :group   => 0,
      :mode    => '0640'
    ) }
  end

  context 'absent' do
    let(:params) do
      { :ensure => 'absent' }
    end
    it { should_not contain_file('/etc/munin/plugins/users') }
    it { should_not contain_file('/etc/munin/plugin-conf.d/users.conf') }
  end
end