]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/apache/spec/classes/mod/deflate_spec.rb
add Openstack modules to 3rdparty
[dsa-puppet.git] / 3rdparty / modules / apache / spec / classes / mod / deflate_spec.rb
1 require 'spec_helper'
2
3 # This function is called inside the OS specific contexts
4 def general_deflate_specs
5   it { is_expected.to contain_apache__mod("deflate") }
6
7   it do
8     is_expected.to contain_file("deflate.conf").with_content(
9       "AddOutputFilterByType DEFLATE text/css\n"\
10       "AddOutputFilterByType DEFLATE text/html\n"\
11       "\n"\
12       "DeflateFilterNote Input instream\n"\
13       "DeflateFilterNote Ratio ratio\n"
14     )
15   end
16 end
17
18 describe 'apache::mod::deflate', :type => :class do
19   let :pre_condition do
20     'class { "apache":
21       default_mods => false,
22     }
23     class { "apache::mod::deflate":
24       types => [ "text/html", "text/css" ],
25       notes => {
26         "Input" => "instream",
27         "Ratio" => "ratio",
28       }
29     }
30     '
31   end
32
33   context "On a Debian OS with default params" do
34     let :facts do
35       {
36         :id                     => 'root',
37         :lsbdistcodename        => 'squeeze',
38         :kernel                 => 'Linux',
39         :osfamily               => 'Debian',
40         :operatingsystem        => 'Debian',
41         :operatingsystemrelease => '6',
42         :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
43         :concat_basedir         => '/dne',
44         :is_pe                  => false,
45       }
46     end
47
48     # Load the more generic tests for this context
49     general_deflate_specs()
50
51     it { is_expected.to contain_file("deflate.conf").with({
52       :ensure => 'file',
53       :path   => '/etc/apache2/mods-available/deflate.conf',
54     } ) }
55     it { is_expected.to contain_file("deflate.conf symlink").with({
56       :ensure => 'link',
57       :path   => '/etc/apache2/mods-enabled/deflate.conf',
58     } ) }
59   end
60
61   context "on a RedHat OS with default params" do
62     let :facts do
63       {
64         :id                     => 'root',
65         :kernel                 => 'Linux',
66         :osfamily               => 'RedHat',
67         :operatingsystem        => 'RedHat',
68         :operatingsystemrelease => '6',
69         :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
70         :concat_basedir         => '/dne',
71         :is_pe                  => false,
72       }
73     end
74
75     # Load the more generic tests for this context
76     general_deflate_specs()
77
78     it { is_expected.to contain_file("deflate.conf").with_path("/etc/httpd/conf.d/deflate.conf") }
79   end
80
81   context "On a FreeBSD OS with default params" do
82     let :facts do
83       {
84         :id                     => 'root',
85         :kernel                 => 'FreeBSD',
86         :osfamily               => 'FreeBSD',
87         :operatingsystem        => 'FreeBSD',
88         :operatingsystemrelease => '9',
89         :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
90         :concat_basedir         => '/dne',
91         :is_pe                  => false,
92       }
93     end
94
95     # Load the more generic tests for this context
96     general_deflate_specs()
97
98     it { is_expected.to contain_file("deflate.conf").with({
99       :ensure => 'file',
100       :path   => '/usr/local/etc/apache24/Modules/deflate.conf',
101     } ) }
102   end
103
104   context "On a Gentoo OS with default params" do
105     let :facts do
106       {
107         :id                     => 'root',
108         :kernel                 => 'Linux',
109         :osfamily               => 'Gentoo',
110         :operatingsystem        => 'Gentoo',
111         :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin',
112         :operatingsystemrelease => '3.16.1-gentoo',
113         :concat_basedir         => '/dne',
114         :is_pe                  => false,
115       }
116     end
117
118     # Load the more generic tests for this context
119     general_deflate_specs()
120
121     it { is_expected.to contain_file("deflate.conf").with({
122       :ensure => 'file',
123       :path   => '/etc/apache2/modules.d/deflate.conf',
124     } ) }
125   end
126 end