]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/apache/spec/classes/mod/dir_spec.rb
add Openstack modules to 3rdparty
[dsa-puppet.git] / 3rdparty / modules / apache / spec / classes / mod / dir_spec.rb
1 require 'spec_helper'
2
3 describe 'apache::mod::dir', :type => :class do
4   let :pre_condition do
5     'class { "apache":
6       default_mods => false,
7     }'
8   end
9   context "on a Debian OS" do
10     let :facts do
11       {
12         :osfamily               => 'Debian',
13         :operatingsystemrelease => '6',
14         :concat_basedir         => '/dne',
15         :operatingsystem        => 'Debian',
16         :id                     => 'root',
17         :kernel                 => 'Linux',
18         :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
19         :lsbdistcodename        => 'squeeze',
20         :is_pe                  => false,
21       }
22     end
23     context "passing no parameters" do
24       it { is_expected.to contain_class("apache::params") }
25       it { is_expected.to contain_apache__mod('dir') }
26       it { is_expected.to contain_file('dir.conf').with_content(/^DirectoryIndex /) }
27       it { is_expected.to contain_file('dir.conf').with_content(/ index\.html /) }
28       it { is_expected.to contain_file('dir.conf').with_content(/ index\.html\.var /) }
29       it { is_expected.to contain_file('dir.conf').with_content(/ index\.cgi /) }
30       it { is_expected.to contain_file('dir.conf').with_content(/ index\.pl /) }
31       it { is_expected.to contain_file('dir.conf').with_content(/ index\.php /) }
32       it { is_expected.to contain_file('dir.conf').with_content(/ index\.xhtml$/) }
33     end
34     context "passing indexes => ['example.txt','fearsome.aspx']" do
35       let :params do
36         {:indexes => ['example.txt','fearsome.aspx']}
37       end
38       it { is_expected.to contain_file('dir.conf').with_content(/ example\.txt /) }
39       it { is_expected.to contain_file('dir.conf').with_content(/ fearsome\.aspx$/) }
40     end
41   end
42   context "on a RedHat OS" do
43     let :facts do
44       {
45         :osfamily               => 'RedHat',
46         :operatingsystemrelease => '6',
47         :concat_basedir         => '/dne',
48         :operatingsystem        => 'Redhat',
49         :id                     => 'root',
50         :kernel                 => 'Linux',
51         :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
52         :is_pe                  => false,
53       }
54     end
55     context "passing no parameters" do
56       it { is_expected.to contain_class("apache::params") }
57       it { is_expected.to contain_apache__mod('dir') }
58       it { is_expected.to contain_file('dir.conf').with_content(/^DirectoryIndex /) }
59       it { is_expected.to contain_file('dir.conf').with_content(/ index\.html /) }
60       it { is_expected.to contain_file('dir.conf').with_content(/ index\.html\.var /) }
61       it { is_expected.to contain_file('dir.conf').with_content(/ index\.cgi /) }
62       it { is_expected.to contain_file('dir.conf').with_content(/ index\.pl /) }
63       it { is_expected.to contain_file('dir.conf').with_content(/ index\.php /) }
64       it { is_expected.to contain_file('dir.conf').with_content(/ index\.xhtml$/) }
65     end
66     context "passing indexes => ['example.txt','fearsome.aspx']" do
67       let :params do
68         {:indexes => ['example.txt','fearsome.aspx']}
69       end
70       it { is_expected.to contain_file('dir.conf').with_content(/ example\.txt /) }
71       it { is_expected.to contain_file('dir.conf').with_content(/ fearsome\.aspx$/) }
72     end
73   end
74   context "on a FreeBSD OS" do
75     let :facts do
76       {
77         :osfamily               => 'FreeBSD',
78         :operatingsystemrelease => '9',
79         :concat_basedir         => '/dne',
80         :operatingsystem        => 'FreeBSD',
81         :id                     => 'root',
82         :kernel                 => 'FreeBSD',
83         :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
84         :is_pe                  => false,
85       }
86     end
87     context "passing no parameters" do
88       it { is_expected.to contain_class("apache::params") }
89       it { is_expected.to contain_apache__mod('dir') }
90       it { is_expected.to contain_file('dir.conf').with_content(/^DirectoryIndex /) }
91       it { is_expected.to contain_file('dir.conf').with_content(/ index\.html /) }
92       it { is_expected.to contain_file('dir.conf').with_content(/ index\.html\.var /) }
93       it { is_expected.to contain_file('dir.conf').with_content(/ index\.cgi /) }
94       it { is_expected.to contain_file('dir.conf').with_content(/ index\.pl /) }
95       it { is_expected.to contain_file('dir.conf').with_content(/ index\.php /) }
96       it { is_expected.to contain_file('dir.conf').with_content(/ index\.xhtml$/) }
97     end
98     context "passing indexes => ['example.txt','fearsome.aspx']" do
99       let :params do
100         {:indexes => ['example.txt','fearsome.aspx']}
101       end
102       it { is_expected.to contain_file('dir.conf').with_content(/ example\.txt /) }
103       it { is_expected.to contain_file('dir.conf').with_content(/ fearsome\.aspx$/) }
104     end
105   end
106   context "on a Gentoo OS" do
107     let :facts do
108       {
109         :osfamily               => 'Gentoo',
110         :operatingsystem        => 'Gentoo',
111         :operatingsystemrelease => '3.16.1-gentoo',
112         :concat_basedir         => '/dne',
113         :id                     => 'root',
114         :kernel                 => 'Linux',
115         :path                   => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin',
116         :is_pe                  => false,
117       }
118     end
119     context "passing no parameters" do
120       it { is_expected.to contain_class("apache::params") }
121       it { is_expected.to contain_apache__mod('dir') }
122       it { is_expected.to contain_file('dir.conf').with_content(/^DirectoryIndex /) }
123       it { is_expected.to contain_file('dir.conf').with_content(/ index\.html /) }
124       it { is_expected.to contain_file('dir.conf').with_content(/ index\.html\.var /) }
125       it { is_expected.to contain_file('dir.conf').with_content(/ index\.cgi /) }
126       it { is_expected.to contain_file('dir.conf').with_content(/ index\.pl /) }
127       it { is_expected.to contain_file('dir.conf').with_content(/ index\.php /) }
128       it { is_expected.to contain_file('dir.conf').with_content(/ index\.xhtml$/) }
129     end
130     context "passing indexes => ['example.txt','fearsome.aspx']" do
131       let :params do
132         {:indexes => ['example.txt','fearsome.aspx']}
133       end
134       it { is_expected.to contain_file('dir.conf').with_content(/ example\.txt /) }
135       it { is_expected.to contain_file('dir.conf').with_content(/ fearsome\.aspx$/) }
136     end
137   end
138 end