-
Notifications
You must be signed in to change notification settings - Fork 575
Expand file tree
/
Copy pathmanage_spec.rb
More file actions
44 lines (39 loc) · 1.11 KB
/
manage_spec.rb
File metadata and controls
44 lines (39 loc) · 1.11 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
# frozen_string_literal: true
require 'spec_helper'
describe 'stdlib::manage' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }
it { is_expected.to compile }
end
end
describe 'with resources to create' do
let :pre_condition do
<<-PRECOND
file { '/etc/motd.d' : }
service { 'sshd' : }
PRECOND
end
let :params do
{
'create_resources' => {
'file' => {
'/etc/motd.d/hello' => {
'content' => 'I say Hi',
'notify' => 'Service[sshd]',
}
},
'package' => {
'example' => {
'ensure' => 'installed',
'subscribe' => ['Service[sshd]', 'File[/etc/motd.d]'],
}
}
}
}
end
it { is_expected.to compile }
it { is_expected.to contain_file('/etc/motd.d/hello').with_content('I say Hi').with_notify('Service[sshd]') }
it { is_expected.to contain_package('example').with_ensure('installed').that_subscribes_to(['Service[sshd]', 'File[/etc/motd.d]']) }
end
end