summaryrefslogtreecommitdiff
path: root/spec/defines/tmpfile_spec.rb
diff options
context:
space:
mode:
authorRaphaël Pinson <github+aem1eeshi1@raphink.net>2016-05-04 09:31:53 +0200
committerRaphaël Pinson <github+aem1eeshi1@raphink.net>2016-05-04 09:31:53 +0200
commit106be55a2469a6b87ac33e0b2fa8bca40ef2cb4d (patch)
tree761ebe4a9b31f80088c551e1f0f123cffb11701d /spec/defines/tmpfile_spec.rb
parent783f6b7a13f21c78d89241b2e5cebe82d80febfb (diff)
parent040f1acf02dc379e3fe577d900b96b47a38a714a (diff)
Merge pull request #4 from felixb/feature/unit-files
Shortcut for creating unit files / tmpfiles
Diffstat (limited to 'spec/defines/tmpfile_spec.rb')
-rw-r--r--spec/defines/tmpfile_spec.rb48
1 files changed, 48 insertions, 0 deletions
diff --git a/spec/defines/tmpfile_spec.rb b/spec/defines/tmpfile_spec.rb
new file mode 100644
index 0000000..4eb22ac
--- /dev/null
+++ b/spec/defines/tmpfile_spec.rb
@@ -0,0 +1,48 @@
+require 'spec_helper'
+
+describe 'systemd::tmpfile' do
+
+ let(:facts) { {
+ :path => '/usr/bin',
+ } }
+
+ context 'default params' do
+
+ let(:title) { 'fancy.conf' }
+
+ it 'creates the tmpfile' do
+ should contain_file('/etc/tmpfiles.d/fancy.conf').with({
+ 'ensure' => 'file',
+ 'owner' => 'root',
+ 'group' => 'root',
+ 'mode' => '0444',
+ })
+ end
+
+ it 'triggers systemd daemon-reload' do
+ should contain_class('systemd')
+ should contain_file('/etc/tmpfiles.d/fancy.conf').with_notify("Exec[systemd-tmpfiles-create]")
+ end
+ end
+
+ context 'with params' do
+ let(:title) { 'fancy.conf' }
+
+ let(:params) { {
+ :ensure => 'absent',
+ :path => '/etc/tmpfiles.d/foo',
+ :content => 'some-content',
+ :source => 'some-source',
+ } }
+
+ it 'creates the unit file' do
+ should contain_file('/etc/tmpfiles.d/foo/fancy.conf').with({
+ 'ensure' => 'absent',
+ 'content' => 'some-content',
+ 'source' => 'some-source',
+ })
+ end
+
+ end
+
+end