diff --git a/spec/classes/collectd_plugin_threshold_spec.rb b/spec/classes/collectd_plugin_threshold_spec.rb index 6e0f82ef2..8157f7e38 100644 --- a/spec/classes/collectd_plugin_threshold_spec.rb +++ b/spec/classes/collectd_plugin_threshold_spec.rb @@ -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