summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJustin Stoller <justin.stoller@gmail.com>2012-05-14 14:29:36 -0700
committerJustin Stoller <justin.stoller@gmail.com>2012-05-14 14:29:36 -0700
commita78aa83ccded7a4323f97991d1ab0c1ec774cb5b (patch)
tree62101f7980f11c9483567bcdd3c48ad6fdc87f15 /spec
parent2575736189a8c60d5895bc06aabfe667ed8cc2d4 (diff)
parent6d96367e56de7299d8791fa0e487adb285a7b202 (diff)
Merge pull request #17 from kbarber/ticket/master/11156-fix_rspec-puppet_tests
(#11156) Fix module path fixtures so rspec works in most rubies
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