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