diff modules/common/spec/defines/mkdir_p_spec.rb @ 388:750d36241580

Add missing dependency modules Probably required by SSH, but not obviously listed
author IBBoard <dev@ibboard.co.uk>
date Mon, 03 Jan 2022 17:15:14 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/common/spec/defines/mkdir_p_spec.rb	Mon Jan 03 17:15:14 2022 +0000
@@ -0,0 +1,27 @@
+require 'spec_helper'
+
+describe 'common::mkdir_p' do
+  context 'should create new directory' do
+    let(:title) { '/some/dir/structure' }
+
+    it {
+      should contain_exec('mkdir_p-/some/dir/structure').with({
+        'command' => 'mkdir -p /some/dir/structure',
+        'unless'  => 'test -d /some/dir/structure',
+      })
+    }
+  end
+
+  context 'should fail with a path that is not absolute' do
+    let(:title) { 'not/a/valid/absolute/path' }
+
+    it do
+      expect {
+        should contain_exec('mkdir_p-not/a/valid/absolute/path').with({
+          'command' => 'mkdir -p not/a/valid/absolute/path',
+          'unless'  => 'test -d not/a/valid/absolute/path',
+        })
+      }.to raise_error(Puppet::Error)
+    end
+  end
+end