Skip to content

Commit 7d0a1e5

Browse files
author
Dan Bode
committed
Merge pull request #9 from kbarber/ticket/11152-temp_puppetconf
(#11152) Create temporary puppetconf area with empty manifests/site.pp
2 parents 887f519 + 2de6949 commit 7d0a1e5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

spec/spec_helper.rb

+15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
require 'puppet'
22
require 'rspec-puppet'
3+
require 'tmpdir'
34

45
RSpec.configure do |c|
6+
c.before :each do
7+
# Create a temporary puppet confdir area and temporary site.pp so
8+
# when rspec-puppet runs we don't get a puppet error.
9+
@puppetdir = Dir.mktmpdir("ntp")
10+
manifestdir = File.join(@puppetdir, "manifests")
11+
Dir.mkdir(manifestdir)
12+
FileUtils.touch(File.join(manifestdir, "site.pp"))
13+
Puppet[:confdir] = @puppetdir
14+
end
15+
16+
c.after :each do
17+
FileUtils.remove_entry_secure(@puppetdir)
18+
end
19+
520
c.module_path = File.join(File.dirname(__FILE__), '../../')
621
end

0 commit comments

Comments
 (0)