Project

General

Profile

Download (2.96 KB) Statistics
| Branch: | Tag: | Revision:
e56d7a1e Ewoud Kohl van Wijngaarden
require 'spec_helper'


describe 'foreman::config::passenger' do
c62fcb8a Ewoud Kohl van Wijngaarden
let :facts do {
:concat_basedir => '/nonexistant',
:fqdn => 'foreman.example.org',
:operatingsystem => 'RedHat',
:operatingsystemrelease => '6.4',
:osfamily => 'RedHat',
} end

describe 'with minimal parameters' do
let :params do {
:app_root => '/usr/share/foreman',
:ssl => false,
:user => 'foreman',
} end

it 'should include apache with modules' do
4b5caab2 Dominic Cleal
should contain_class('apache').that_comes_before('Anchor[foreman::config::passenger_end]')
c62fcb8a Ewoud Kohl van Wijngaarden
should contain_class('apache::mod::headers')
should contain_class('apache::mod::passenger')
e56d7a1e Ewoud Kohl van Wijngaarden
end

c62fcb8a Ewoud Kohl van Wijngaarden
it 'should ensure ownership' do
should contain_file("#{params[:app_root]}/config.ru").with_owner(params[:user])
should contain_file("#{params[:app_root]}/config/environment.rb").with_owner(params[:user])
e56d7a1e Ewoud Kohl van Wijngaarden
end
c62fcb8a Ewoud Kohl van Wijngaarden
end
e56d7a1e Ewoud Kohl van Wijngaarden
c62fcb8a Ewoud Kohl van Wijngaarden
describe 'with vhost and ssl' do
let :params do {
:app_root => '/usr/share/foreman',
:use_vhost => true,
:ssl => true,
:ssl_cert => 'cert.pem',
:ssl_key => 'key.pem',
:ssl_ca => 'ca.pem',
} end

it 'should contain the docroot' do
should contain_file("#{params[:app_root]}/public")
e56d7a1e Ewoud Kohl van Wijngaarden
end
72a44e51 Ewoud Kohl van Wijngaarden
36cd597e Justin Sherrill
it 'should contain virt host plugin dir' do
should contain_file('/etc/httpd/conf.d/05-foreman.d').with({
'ensure' => 'directory',
})
end

it 'should contain ssl virt host plugin dir' do
should contain_file('/etc/httpd/conf.d/05-foreman-ssl.d').with({
'ensure' => 'directory',
})
end

c62fcb8a Ewoud Kohl van Wijngaarden
it 'should include a http vhost' do
should contain_apache__vhost('foreman').with({
:ip => nil,
:servername => facts[:fqdn],
:serveraliases => ['foreman'],
:docroot => "#{params[:app_root]}/public",
700c74ff Justin Sherrill
:priority => '05',
720ae6e9 Mickaël Canévet
:options => ['SymLinksIfOwnerMatch'],
c62fcb8a Ewoud Kohl van Wijngaarden
:port => 80,
:custom_fragment => %r{^<Directory #{params[:app_root]}/public>$},
})
72a44e51 Ewoud Kohl van Wijngaarden
end
222fb5e5 Adam Heinz
c62fcb8a Ewoud Kohl van Wijngaarden
it 'should include a https vhost' do
should contain_apache__vhost('foreman-ssl').with({
:ip => nil,
:servername => facts[:fqdn],
:serveraliases => ['foreman'],
:docroot => "#{params[:app_root]}/public",
700c74ff Justin Sherrill
:priority => '05',
720ae6e9 Mickaël Canévet
:options => ['SymLinksIfOwnerMatch'],
c62fcb8a Ewoud Kohl van Wijngaarden
:port => 443,
:ssl => true,
:ssl_cert => params[:ssl_cert],
:ssl_key => params[:ssl_key],
1ed16264 Jean-Baptiste Rouault
:ssl_chain => params[:ssl_chain],
c62fcb8a Ewoud Kohl van Wijngaarden
:ssl_ca => params[:ssl_ca],
:ssl_verify_client => 'optional',
:ssl_options => '+StdEnvVars',
:ssl_verify_depth => '3',
:custom_fragment => %r{^<Directory #{params[:app_root]}/public>$},
})
222fb5e5 Adam Heinz
end
e56d7a1e Ewoud Kohl van Wijngaarden
end
end