Skip to content

Commit

Permalink
test the interface not the result
Browse files Browse the repository at this point in the history
  • Loading branch information
kitchen committed Jan 16, 2015
1 parent 9276be2 commit 55054bd
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions spec/classes/collectd_plugin_java_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@

context ':ensure => present, defaults' do
it 'Will load the plugin' do
should contain_file('java.load').with({
should contain_collectd__plugin('java').with({
:ensure => 'present',
:path => '/etc/collectd.d/10-java.conf',
})

should contain_file('java.load').without_content(/JVMArg/)
should contain_collectd__plugin('java').without_content(/JVMArg/)
end
end

Expand All @@ -22,9 +21,8 @@
}}

it 'will not load the plugin' do
should contain_file('java.load').with({
:ensure => 'absent',
:path => '/etc/collectd.d/10-java.conf',
should contain_collectd__plugin('java').with({
:ensure => 'absent'
})
end
end
Expand All @@ -35,7 +33,7 @@
}}

it 'will have multiple JVMArg bits' do
should contain_file('java.load').with_content(/JVMArg "foo"[\s\n]+JVMArg "bar"[\s\n]+JVMArg "baz"/)
should contain_collectd__plugin('java').with_content(/JVMArg "foo"[\s\n]+JVMArg "bar"[\s\n]+JVMArg "baz"/)
end
end

Expand All @@ -45,11 +43,11 @@
}}

it 'will have a JVMArg bit' do
should contain_file('java.load').with_content(/JVMArg "bat"/)
should contain_collectd__plugin('java').with_content(/JVMArg "bat"/)
end

it 'will only have one JVMArg bit' do
should contain_file('java.load').without_content(/(.*JVMArg.*){2,}/)
should contain_collectd__plugin('java').without_content(/(.*JVMArg.*){2,}/)
end
end

Expand All @@ -59,8 +57,7 @@
}}

it 'will not have a <Plugin java> stanza' do
should contain_file('java.load').without_content(/<Plugin java>/)
should contain_collectd__plugin('java').without_content(/<Plugin java>/)
end
end
end

0 comments on commit 55054bd

Please sign in to comment.