2013-11-22 04:10:53 +01:00
|
|
|
require 'spec_helper'
|
|
|
|
describe 'nginx::service' do
|
|
|
|
|
|
|
|
let :facts do {
|
|
|
|
:osfamily => 'Debian',
|
|
|
|
:operatingsystem => 'debian',
|
|
|
|
} end
|
|
|
|
|
2014-03-04 17:46:45 +01:00
|
|
|
let :params do {
|
|
|
|
:configtest_enable => false,
|
|
|
|
:service_restart => '/etc/init.d/nginx configtest && /etc/init.d/nginx restart',
|
|
|
|
:service_ensure => 'running',
|
|
|
|
} end
|
2013-11-22 04:10:53 +01:00
|
|
|
|
|
|
|
context "using default parameters" do
|
|
|
|
|
|
|
|
it { should contain_service('nginx').with(
|
|
|
|
:ensure => 'running',
|
|
|
|
:enable => true,
|
|
|
|
:hasstatus => true,
|
2013-12-01 01:56:38 +01:00
|
|
|
:hasrestart => true
|
2013-11-22 04:10:53 +01:00
|
|
|
)}
|
|
|
|
|
|
|
|
it { should contain_service('nginx').without_restart }
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "when configtest_enable => true" do
|
2014-03-04 17:46:45 +01:00
|
|
|
let(:params) {{ :configtest_enable => true, :service_restart => '/etc/init.d/nginx configtest && /etc/init.d/nginx restart'}}
|
2013-11-22 04:10:53 +01:00
|
|
|
it { should contain_service('nginx').with_restart('/etc/init.d/nginx configtest && /etc/init.d/nginx restart') }
|
|
|
|
|
|
|
|
context "when service_restart => 'a restart command'" do
|
|
|
|
let(:params) {{ :configtest_enable => true, :service_restart => 'a restart command' }}
|
|
|
|
it { should contain_service('nginx').with_restart('a restart command') }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|