summaryrefslogtreecommitdiff
path: root/spec/spec_helper.rb
diff options
context:
space:
mode:
authorKen Barber <ken@bob.sh>2012-05-14 12:04:02 +0100
committerKen Barber <ken@bob.sh>2012-05-14 21:51:20 +0100
commit6d96367e56de7299d8791fa0e487adb285a7b202 (patch)
treeae9a0d20cc760bf2a72b479b502d276b76b3a267 /spec/spec_helper.rb
parent0b39d32f9b2fbfab83081db78600a27d3fa4a274 (diff)
(#11156) Fix module path fixtures so rspec works in most rubies
Previously this module was using an experimental pattern using mktmpdir for creating its module path for rspec-puppet to use, which has since been deprecated in favour of a static directory. This was largely because ntp was one of the earlier modules we tried to make work in Jenkins. This change aligns the module to use the same pattern used in the rspec- puppet setup stage: https://github.com/rodjek/rspec-puppet/blob/master/lib/rspec-puppet/setup.rb This should stop the problems with Ruby 1.8.5 complaining about a lack of mktmpdir, and also make it more consistent with other modules in the wild.
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r--spec/spec_helper.rb23
1 files changed, 5 insertions, 18 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 1474db1..b485228 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,23 +1,10 @@
require 'puppet'
require 'rspec-puppet'
-require 'tmpdir'
+require 'puppet_spec_helper'
-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
- Puppet.settings.send(:initialize_everything_for_tests) unless Puppet.version =~ /^2\.6/
- end
-
- c.after :each do
- Puppet.settings.send(:clear_everything_for_tests) unless Puppet.version =~ /^2\.6/
- FileUtils.remove_entry_secure(@puppetdir)
- end
+fixture_dir = File.join(dir = File.expand_path(File.dirname(__FILE__)), "fixtures")
- c.module_path = File.join(File.dirname(__FILE__), '../../')
+RSpec.configure do |c|
+ c.module_path = File.join(fixture_dir, 'modules')
+ c.manifest_dir = File.join(fixture_dir, 'manifests')
end