]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/apache/spec/acceptance/mod_negotiation_spec.rb
add Openstack modules to 3rdparty
[dsa-puppet.git] / 3rdparty / modules / apache / spec / acceptance / mod_negotiation_spec.rb
1 require 'spec_helper_acceptance'
2
3 describe 'apache::mod::negotiation class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
4   case fact('osfamily')
5   when 'Debian'
6     vhost_dir    = '/etc/apache2/sites-enabled'
7     mod_dir      = '/etc/apache2/mods-available'
8     service_name = 'apache2'
9   when 'RedHat'
10     vhost_dir    = '/etc/httpd/conf.d'
11     mod_dir      = '/etc/httpd/conf.d'
12     service_name = 'httpd'
13   when 'FreeBSD'
14     vhost_dir    = '/usr/local/etc/apache24/Vhosts'
15     mod_dir      = '/usr/local/etc/apache24/Modules'
16     service_name = 'apache24'
17   when 'Gentoo'
18     vhost_dir    = '/etc/apache2/vhosts.d'
19     mod_dir      = '/etc/apache2/modules.d'
20     service_name = 'apache2'
21   end
22
23   context "default negotiation config" do
24     it 'succeeds in puppeting negotiation' do
25       pp= <<-EOS
26         class { '::apache': default_mods => false }
27         class { '::apache::mod::negotiation': }
28       EOS
29       apply_manifest(pp, :catch_failures => true)
30     end
31
32     describe file("#{mod_dir}/negotiation.conf") do
33       it { should contain "LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW
34 ForceLanguagePriority Prefer Fallback" }
35     end
36
37     describe service(service_name) do
38       it { should be_enabled }
39       it { should be_running }
40     end
41   end
42
43   context "with alternative force_language_priority" do
44     it 'succeeds in puppeting negotiation' do
45       pp= <<-EOS
46         class { '::apache': default_mods => false }
47         class { '::apache::mod::negotiation':
48           force_language_priority => 'Prefer',
49         }
50       EOS
51       apply_manifest(pp, :catch_failures => true)
52     end
53
54     describe file("#{mod_dir}/negotiation.conf") do
55       it { should contain "ForceLanguagePriority Prefer" }
56     end
57
58     describe service(service_name) do
59       it { should be_enabled }
60       it { should be_running }
61     end
62   end
63
64   context "with alternative language_priority" do
65     it 'succeeds in puppeting negotiation' do
66       pp= <<-EOS
67         class { '::apache': default_mods => false }
68         class { '::apache::mod::negotiation':
69           language_priority => [ 'en', 'es' ],
70         }
71       EOS
72       apply_manifest(pp, :catch_failures => true)
73     end
74
75     describe file("#{mod_dir}/negotiation.conf") do
76       it { should contain "LanguagePriority en es" }
77     end
78
79     describe service(service_name) do
80       it { should be_enabled }
81       it { should be_running }
82     end
83   end
84 end