Skip to content

Commit 84dfe8a

Browse files
committed
add logfile parameter test
1 parent a0f7b87 commit 84dfe8a

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

spec/classes/ntp_spec.rb

+27-1
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,33 @@
207207
end
208208
end
209209
end
210+
211+
describe 'with parameter logfile' do
212+
context 'when set to true' do
213+
let(:params) {{
214+
:servers => ['a', 'b', 'c', 'd'],
215+
:logfile => '/var/log/foobar.log',
216+
}}
217+
218+
it 'should contain logfile setting' do
219+
should contain_file('/etc/ntp.conf').with({
220+
'content' => /^logfile = \/var\/log\/foobar\.log\n/,
221+
})
222+
end
223+
end
224+
225+
context 'when set to false' do
226+
let(:params) {{
227+
:servers => ['a', 'b', 'c', 'd'],
228+
}}
229+
230+
it 'should not contain a logfile line' do
231+
should_not contain_file('/etc/ntp.conf').with({
232+
'content' => /logfile =/,
233+
})
234+
end
235+
end
236+
end
210237
end
211238
end
212239

@@ -365,5 +392,4 @@
365392
end
366393
end
367394
end
368-
369395
end

0 commit comments

Comments
 (0)