Skip to content

Commit

Permalink
migrate collectd_plugin_threshold tests to rspec-puppet-facts
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed May 27, 2017
1 parent 5862dc0 commit b818ee5
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions spec/classes/collectd_plugin_threshold_spec.rb
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
require 'spec_helper'

describe 'collectd::plugin::threshold', type: :class do
let :facts do
{
osfamily: 'Debian',
concat_basedir: '/dne',
id: 'root',
kernel: 'Linux',
path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
collectd_version: '5.0',
operatingsystemmajrelease: '7',
python_dir: '/usr/local/lib/python2.7/dist-packages'
}
end
on_supported_os.each do |os, facts|
context "on #{os} " do
let :facts do
facts
end

context ':ensure => present' do
context ':ensure => present and default parameters' do
it 'Will create /etc/collectd/conf.d/10-threshold.conf to load the plugin' do
is_expected.to contain_file('threshold.load').
with(ensure: 'present',
path: '/etc/collectd/conf.d/10-threshold.conf',
content: %r{LoadPlugin threshold})
options = os_specific_options(facts)
context ':ensure => present' do
context ':ensure => present and default parameters' do
it "Will create #{options[:plugin_conf_dir]}/10-threshold.conf to load the plugin" do
is_expected.to contain_file('threshold.load').with(
ensure: 'present',
path: "#{options[:plugin_conf_dir]}/10-threshold.conf",
content: %r{LoadPlugin threshold}
)
end
end
end
end
end
Expand Down

0 comments on commit b818ee5

Please sign in to comment.