-
-
Notifications
You must be signed in to change notification settings - Fork 883
/
service_spec.rb
50 lines (42 loc) · 1.39 KB
/
service_spec.rb
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
require 'spec_helper'
describe 'nginx::service' do
let :params do {
:configtest_enable => false,
:service_restart => '/etc/init.d/nginx reload',
:service_ensure => 'running',
:service_name => 'nginx',
} end
context "using default parameters" do
it { is_expected.to contain_service('nginx').with(
:ensure => 'running',
:enable => true,
:hasstatus => true,
:hasrestart => true
)}
it { is_expected.to contain_service('nginx').without_restart }
end
describe "when configtest_enable => true" do
let :params do {
:configtest_enable => true,
:service_restart => '/etc/init.d/nginx reload',
:service_ensure => 'running',
:service_name => 'nginx',
} end
it { is_expected.to contain_service('nginx').with_restart('/etc/init.d/nginx reload') }
context "when service_restart => 'a restart command'" do
let :params do {
:configtest_enable => true,
:service_restart => 'a restart command',
:service_ensure => 'running',
:service_name => 'nginx',
} end
it { is_expected.to contain_service('nginx').with_restart('a restart command') }
end
end
describe "when service_name => 'nginx14" do
let :params do {
:service_name => 'nginx14',
} end
it { is_expected.to contain_service('nginx').with_name('nginx14') }
end
end