summaryrefslogtreecommitdiff
path: root/spec
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
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')
-rw-r--r--spec/fixtures/manifests/site.pp0
l---------spec/fixtures/modules/ntp1
-rw-r--r--spec/spec_helper.rb23
3 files changed, 6 insertions, 18 deletions
diff --git a/spec/fixtures/manifests/site.pp b/spec/fixtures/manifests/site.pp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/spec/fixtures/manifests/site.pp
diff --git a/spec/fixtures/modules/ntp b/spec/fixtures/modules/ntp
new file mode 120000
index 0000000..1b20c9f
--- /dev/null
+++ b/spec/fixtures/modules/ntp
@@ -0,0 +1 @@
+../../../ \ No newline at end of file
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