From 9ca5d941bf60ecff8d2d20582d288b41b5f68f22 Mon Sep 17 00:00:00 2001 From: Chris Heerschap Date: Fri, 24 Jul 2015 20:53:15 -0400 Subject: [PATCH] improving the memory spec --- spec/classes/collectd_plugin_memory_spec.rb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/spec/classes/collectd_plugin_memory_spec.rb b/spec/classes/collectd_plugin_memory_spec.rb index ae70843d4..bb7b8a5dc 100644 --- a/spec/classes/collectd_plugin_memory_spec.rb +++ b/spec/classes/collectd_plugin_memory_spec.rb @@ -10,11 +10,27 @@ should contain_file('memory.load').with({ :ensure => 'present', :path => '/etc/collectd.d/10-memory.conf', - :content => /\#\ Generated by Puppet\n\n Globals false\n<\/LoadPlugin>\n/, + :content => /LoadPlugin memory/, }) end end + context ':ensure => present' do + context ':ensure => present and collectd version < 5.5' do + + it 'Will create /etc/collectd.d/10-memory.conf to load the plugin' do + should contain_file('cpu.load').with({ + :ensure => 'present', + :path => '/etc/collectd.d/10-memory.conf', + :content => /LoadPlugin memory/, + }) + end + + it 'Will not include ValuesPercentage in /etc/collectd.d/10-memory.conf' do + should_not contain_file('cpu.load').with_content(/ValuesPercentage/) + end + end + context ':ensure => present, specific params, collectd version 5.5.0' do let :facts do { :osfamily => 'Redhat',