forked from puppetlabs/puppetlabs-apache
-
Notifications
You must be signed in to change notification settings - Fork 0
/
class_spec.rb
58 lines (50 loc) · 1.46 KB
/
class_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
require 'spec_helper_acceptance'
describe 'apache class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
case fact('osfamily')
when 'RedHat'
package_name = 'httpd'
service_name = 'httpd'
when 'Debian'
package_name = 'apache2'
service_name = 'apache2'
when 'FreeBSD'
package_name = 'apache22'
service_name = 'apache22'
end
context 'default parameters' do
it 'should work with no errors' do
pp = <<-EOS
class { 'apache': }
EOS
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
end
describe package(package_name) do
it { should be_installed }
end
describe service(service_name) do
it { should be_enabled }
it { should be_running }
end
end
context 'custom site/mod dir parameters' do
# Using puppet_apply as a helper
it 'should work with no errors' do
pp = <<-EOS
file { '/tmp/apache_custom': ensure => directory, }
class { 'apache':
mod_dir => '/tmp/apache_custom/mods',
vhost_dir => '/tmp/apache_custom/vhosts',
}
EOS
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
describe service(service_name) do
it { should be_enabled }
it { should be_running }
end
end
end