Skip to content

Commit

Permalink
add rspec test
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Throckmorton committed Jun 19, 2015
1 parent 8c2ad77 commit 67af5f9
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions spec/classes/collectd_plugin_protocols_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
require 'spec_helper'

describe 'collectd::plugin::protocols', :type => :class do
let :facts do
{:osfamily => 'RedHat'}
end

context ':ensure => present, default params' do
it 'Will create /etc/collectd.d/10-protocols.conf' do
should contain_file('protocols.load').with({
:ensure => 'present',
:path => '/etc/collectd.d/10-protocols.conf',
:content => //,
})
end
end

context ':ensure => present, specific params' do
let :params do
{ :values => [ 'protocol1', 'protocol2' ],
}
end

it 'Will create /etc/collectd.d/10-protocols.conf' do
should contain_file('protocols.load').with({
:ensure => 'present',
:path => '/etc/collectd.d/10-protocols.conf',
:content => /<Plugin "protocols">\n\s*Value "protocol1"\n\s*Value "protocol2"\n<\/Plugin>/,
})
end
end

context ':ensure => absent' do
let :params do
{:ensure => 'absent'}
end

it 'Will not create /etc/collectd.d/10-protocols.conf' do
should contain_file('protocols.load').with({
:ensure => 'absent',
:path => '/etc/collectd.d/10-protocols.conf',
})
end
end
end

0 comments on commit 67af5f9

Please sign in to comment.