summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Bode <dan@bodepd.com>2011-12-03 18:35:29 -0800
committerDan Bode <dan@bodepd.com>2011-12-03 18:35:29 -0800
commit7d0a1e564f73c23ea2ca4d134b3a319598243c29 (patch)
tree78328391779e8f7cc2fe54ba7d6e0ce6b624bff1
parent887f519faceec6587ebfa4a440d627774c9467d5 (diff)
parent2de694927175dcfd0752a1bf1a961e495ed0ffdc (diff)
Merge pull request #9 from kbarber/ticket/11152-temp_puppetconf
(#11152) Create temporary puppetconf area with empty manifests/site.pp
-rw-r--r--spec/spec_helper.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index ab7e2db..10afd38 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,6 +1,21 @@
require 'puppet'
require 'rspec-puppet'
+require 'tmpdir'
RSpec.configure do |c|
+ c.before :each do
+ # Create a temporary puppet confdir area and temporary site.pp so
+ # when rspec-puppet runs we don't get a puppet error.
+ @puppetdir = Dir.mktmpdir("ntp")
+ manifestdir = File.join(@puppetdir, "manifests")
+ Dir.mkdir(manifestdir)
+ FileUtils.touch(File.join(manifestdir, "site.pp"))
+ Puppet[:confdir] = @puppetdir
+ end
+
+ c.after :each do
+ FileUtils.remove_entry_secure(@puppetdir)
+ end
+
c.module_path = File.join(File.dirname(__FILE__), '../../')
end