forked from puppetlabs-toy-chest/puppetlabs-passenger
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit_spec.rb
More file actions
182 lines (157 loc) · 6.57 KB
/
Copy pathinit_spec.rb
File metadata and controls
182 lines (157 loc) · 6.57 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
require 'spec_helper'
describe 'passenger' do
context 'when installing passenger 5' do
let(:facts) do
{ :osfamily => 'redhat', :operatingsystemrelease => '6.4', :concat_basedir => '/dne' }
end
let(:params) do
{
:passenger_version => '5.0.9',
:passenger_ruby => '/opt/bin/ruby',
:gem_path => '/opt/lib/ruby/gems/1.9.1/gems',
:gem_binary_path => '/opt/lib/ruby/bin',
:passenger_root => '/opt/lib/ruby/gems/1.9.1/gems/passenger-3.0.19',
:mod_passenger_location => '/opt/lib/ruby/gems/1.9.1/gems/passenger-3.0.19/ext/apache2/mod_passenger.so'
}
end
it 'should configure PassengerEnabled' do
should contain_file('/etc/httpd/conf.d/passenger.conf').with_content(/^PassengerEnabled on/)
end
end
context 'when installing passenger 4' do
let(:facts) do
{ :osfamily => 'redhat', :operatingsystemrelease => '6.4', :concat_basedir => '/dne' }
end
let(:params) do
{
:passenger_version => '4.0.59',
:passenger_ruby => '/opt/bin/ruby',
:gem_path => '/opt/lib/ruby/gems/1.9.1/gems',
:gem_binary_path => '/opt/lib/ruby/bin',
:passenger_root => '/opt/lib/ruby/gems/1.9.1/gems/passenger-3.0.19',
:mod_passenger_location => '/opt/lib/ruby/gems/1.9.1/gems/passenger-3.0.19/ext/apache2/mod_passenger.so'
}
end
it 'should configure PassengerEnabled' do
should contain_file('/etc/httpd/conf.d/passenger.conf').with_content(/^PassengerEnabled on/)
end
end
context 'when installing passenger 3' do
let(:facts) do
{ :osfamily => 'redhat', :operatingsystemrelease => '6.4', :concat_basedir => '/dne' }
end
let(:params) do
{
:passenger_version => '3.0.19',
:passenger_ruby => '/opt/bin/ruby',
:gem_path => '/opt/lib/ruby/gems/1.9.1/gems',
:gem_binary_path => '/opt/lib/ruby/bin',
:passenger_root => '/opt/lib/ruby/gems/1.9.1/gems/passenger-3.0.19',
:mod_passenger_location => '/opt/lib/ruby/gems/1.9.1/gems/passenger-3.0.19/ext/apache2/mod_passenger.so'
}
end
describe 'with compile_passenger => false' do
let(:facts) do
{ :osfamily => 'redhat', :operatingsystemrelease => '6.4', :concat_basedir => '/dne' }
end
let(:params) do
{
:passenger_version => '3.0.19',
:passenger_ruby => '/opt/bin/ruby',
:gem_path => '/opt/lib/ruby/gems/1.9.1/gems',
:gem_binary_path => '/opt/lib/ruby/bin',
:passenger_root => '/opt/lib/ruby/gems/1.9.1/gems/passenger-3.0.19',
:mod_passenger_location => '/opt/lib/ruby/gems/1.9.1/gems/passenger-3.0.19/ext/apache2/mod_passenger.so',
:compile_passenger => false,
}
end
it { should_not contain_class('passenger::compile')}
end
describe 'with include_build_tools' do
context 'using the default value' do
let(:params) { { :include_build_tools => false } }
it { should_not contain_class('gcc') }
it { should_not contain_class('make') }
it { should compile.with_all_deps }
end
['true',true].each do |value|
context "specified as #{value}" do
let(:params) { { :include_build_tools => value } }
it { should contain_class('gcc') }
it { should contain_class('make') }
it { should compile.with_all_deps }
end
end
['false',false].each do |value|
context "specified as #{value}" do
let(:params) { { :include_build_tools => value } }
it { should_not contain_class('gcc') }
it { should_not contain_class('make') }
it { should compile.with_all_deps }
end
end
end
describe 'on RedHat' do
let(:facts) do
{ :osfamily => 'redhat', :operatingsystemrelease => '6.4', :concat_basedir => '/dne' }
end
it 'adds libcurl-devel for compilation' do
should contain_package('libcurl-devel')
end
it 'adds httpd config' do
should contain_file('/etc/httpd/conf.d/passenger.conf').with_content(/PassengerRuby \/opt\/bin\/ruby/)
should contain_file('/etc/httpd/conf.d/passenger.conf').with_content(/LoadModule passenger_module \/opt\/lib\/ruby\/gems\/1.9.1\/gems\/passenger-3.0.19\/ext\/apache2\/mod_passenger.so/)
should contain_file('/etc/httpd/conf.d/passenger.conf').with_content(/PassengerRoot \/opt\/lib\/ruby\/gems\/1.9.1\/gems\/passenger-3.0.19/)
end
it "should configure RailsAutoDetect" do
should contain_file('/etc/httpd/conf.d/passenger.conf').with_content(/^RailsAutoDetect On/)
end
end
describe 'on Debian' do
let(:facts) do
{ :osfamily => 'debian', :operatingsystemrelease => '7', :concat_basedir => '/dne' }
end
it 'adds mods-available files' do
should contain_file('/etc/apache2/mods-available/passenger.conf')
should contain_file('/etc/apache2/mods-available/passenger.load')
end
it 'adds symlinks mods-enabled to load modules' do
should contain_file('/etc/apache2/mods-enabled/passenger.conf').with(
:ensure => 'link',
:target => '/etc/apache2/mods-available/passenger.conf'
)
should contain_file('/etc/apache2/mods-enabled/passenger.load').with(
:ensure => 'link',
:target => '/etc/apache2/mods-available/passenger.load'
)
end
it "should configure RailsAutoDetect" do
should contain_file('/etc/apache2/mods-available/passenger.conf').with_content(/^RailsAutoDetect On/)
end
end
['redhat', 'debian'].each do |osfamily|
context "on #{osfamily}" do
let(:facts) do
{ :osfamily => osfamily, :operatingsystemrelease => 'thing', :concat_basedir => '/dne' }
end
context "with customized params" do
it 'compiles the apache module' do
should contain_exec('compile-passenger').with(
:path => ['/opt/lib/ruby/bin', '/usr/bin', '/bin', '/usr/local/bin'],
:creates => '/opt/lib/ruby/gems/1.9.1/gems/passenger-3.0.19/ext/apache2/mod_passenger.so'
)
end
it 'adds passenger package' do
should contain_package('passenger').with(
:name => 'passenger',
:provider => 'gem'
)
end
it 'includes apache' do
should contain_class('apache')
end
end
end
end
end
end