3 describe 'apache::custom_config', :type => :define do
12 :osfamily => 'Debian',
13 :operatingsystemrelease => '6',
14 :concat_basedir => '/',
15 :lsbdistcodename => 'squeeze',
16 :operatingsystem => 'Debian',
19 :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
23 context 'defaults with content' do
26 'content' => '# Test',
29 it { is_expected.to contain_exec("service notify for rspec").with({
30 'refreshonly' => 'true',
31 'subscribe' => 'File[apache_rspec]',
32 'command' => '/usr/sbin/apachectl -t',
33 'notify' => 'Class[Apache::Service]',
34 'before' => 'Exec[remove rspec if invalid]',
37 it { is_expected.to contain_exec("remove rspec if invalid").with({
38 'unless' => '/usr/sbin/apachectl -t',
39 'subscribe' => 'File[apache_rspec]',
40 'refreshonly' => 'true',
43 it { is_expected.to contain_file("apache_rspec").with({
44 'ensure' => 'present',
45 'content' => '# Test',
46 'require' => 'Package[httpd]',
50 context 'set everything with source' do
55 'source' => 'puppet:///modules/apache/test',
56 'verify_command' => '/bin/true',
59 it { is_expected.to contain_exec("service notify for rspec").with({
60 'command' => '/bin/true',
63 it { is_expected.to contain_exec("remove rspec if invalid").with({
64 'command' => '/bin/rm /dne/30-rspec.conf',
65 'unless' => '/bin/true',
68 it { is_expected.to contain_file("apache_rspec").with({
69 'path' => '/dne/30-rspec.conf',
70 'ensure' => 'present',
71 'source' => 'puppet:///modules/apache/test',
72 'require' => 'Package[httpd]',
76 context 'verify_config => false' do
79 'content' => '# test',
80 'verify_config' => false,
83 it { is_expected.to_not contain_exec('service notify for rspec') }
84 it { is_expected.to_not contain_exec('remove rspec if invalid') }
85 it { is_expected.to contain_file('apache_rspec').with({
86 'notify' => 'Class[Apache::Service]'
90 context 'ensure => absent' do
96 it { is_expected.to_not contain_exec('service notify for rspec') }
97 it { is_expected.to_not contain_exec('remove rspec if invalid') }
98 it { is_expected.to contain_file('apache_rspec').with({
103 describe 'validation' do
104 context 'both content and source' do
114 }.to raise_error(Puppet::Error, /Only one of \$content and \$source can be specified\./)
117 context 'neither content nor source' do
121 }.to raise_error(Puppet::Error, /One of \$content and \$source must be specified\./)
124 context 'bad ensure' do
134 }.to raise_error(Puppet::Error, /is not supported for ensure/)