module-nginx/spec/classes/service_spec.rb

42 lines
1.2 KiB
Ruby
Raw Normal View History

2013-11-22 04:10:53 +01:00
require 'spec_helper'
describe 'nginx::service' do
let :params do {
:configtest_enable => false,
:service_restart => '/etc/init.d/nginx configtest && /etc/init.d/nginx restart',
:service_ensure => 'running',
2014-09-21 01:25:24 +02:00
} end
2013-11-22 04:10:53 +01:00
context "using default parameters" do
it { is_expected.to contain_service('nginx').with(
2013-11-22 04:10:53 +01:00
:ensure => 'running',
:enable => true,
:hasstatus => true,
:hasrestart => true
2013-11-22 04:10:53 +01:00
)}
it { is_expected.to contain_service('nginx').without_restart }
2013-11-22 04:10:53 +01:00
end
describe "when configtest_enable => true" do
let :params do {
:configtest_enable => true,
:service_restart => '/etc/init.d/nginx configtest && /etc/init.d/nginx restart',
:service_ensure => 'running',
} end
it { is_expected.to contain_service('nginx').with_restart('/etc/init.d/nginx configtest && /etc/init.d/nginx restart') }
2013-11-22 04:10:53 +01:00
context "when service_restart => 'a restart command'" do
let :params do {
:configtest_enable => true,
:service_restart => 'a restart command',
:service_ensure => 'running',
} end
it { is_expected.to contain_service('nginx').with_restart('a restart command') }
2013-11-22 04:10:53 +01:00
end
end
end