summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorMatt Robinson <matt@puppetlabs.com>2010-11-08 12:04:26 -0800
committerMatt Robinson <matt@puppetlabs.com>2010-11-08 12:04:26 -0800
commit21db472640c8e606565c9693d4737f40a1bf8cce (patch)
tree1c1068b0ba6273779efb9a9194859665980df607 /spec
parent244213c856f3753dd3e06c5f01003f6a0d3f77ef (diff)
downloadpuppet-21db472640c8e606565c9693d4737f40a1bf8cce.tar.gz
puppet-21db472640c8e606565c9693d4737f40a1bf8cce.tar.xz
puppet-21db472640c8e606565c9693d4737f40a1bf8cce.zip
(#5233) Randomize tmp dir paths
Standardize how we create tmpdirs by using the puppet function instead of Dir.tmpdir. Paired-with: Paul Berry <paul@puppetlabs.com>
Diffstat (limited to 'spec')
-rw-r--r--spec/spec_helper.rb2
-rw-r--r--spec/unit/network/handler/fileserver_spec.rb6
-rwxr-xr-xspec/unit/provider/ssh_authorized_key/parsed_spec.rb3
-rwxr-xr-xspec/unit/util/storage_spec.rb5
4 files changed, 6 insertions, 10 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index b5b273857..ed4e2c2fb 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -20,7 +20,7 @@ module PuppetSpec
FIXTURE_DIR = File.join(dir = File.expand_path(File.dirname(__FILE__)), "fixtures") unless defined?(FIXTURE_DIR)
end
-require 'spec/lib/puppet_spec/files'
+require 'lib/puppet_spec/files'
require 'monkey_patches/alias_should_to_must'
require 'monkey_patches/add_confine_and_runnable_to_rspec_dsl'
require 'monkey_patches/publicize_methods'
diff --git a/spec/unit/network/handler/fileserver_spec.rb b/spec/unit/network/handler/fileserver_spec.rb
index 40d1e57cd..b37d4f551 100644
--- a/spec/unit/network/handler/fileserver_spec.rb
+++ b/spec/unit/network/handler/fileserver_spec.rb
@@ -4,9 +4,8 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
require 'puppet/network/handler/fileserver'
-
describe Puppet::Network::Handler::FileServer do
- require 'tmpdir'
+ include PuppetSpec::Files
def create_file(filename)
File.open(filename, "w") { |f| f.puts filename}
@@ -20,8 +19,7 @@ describe Puppet::Network::Handler::FileServer do
end
before do
- @basedir = File.join(Dir.tmpdir, "test_network_handler")
- Dir.mkdir(@basedir)
+ @basedir = tmpdir("test_network_handler")
@file = File.join(@basedir, "aFile")
@link = File.join(@basedir, "aLink")
create_file(@file)
diff --git a/spec/unit/provider/ssh_authorized_key/parsed_spec.rb b/spec/unit/provider/ssh_authorized_key/parsed_spec.rb
index 648527924..11e9233e0 100755
--- a/spec/unit/provider/ssh_authorized_key/parsed_spec.rb
+++ b/spec/unit/provider/ssh_authorized_key/parsed_spec.rb
@@ -5,7 +5,6 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
require 'puppet_spec/files'
require 'puppettest/support/utils'
require 'puppettest/fileparsing'
-require 'tmpdir'
require 'puppettest/fakes'
provider_class = Puppet::Type.type(:ssh_authorized_key).provider(:parsed)
@@ -19,7 +18,7 @@ describe provider_class do
before :each do
@sshauthkey_class = Puppet::Type.type(:ssh_authorized_key)
@provider = @sshauthkey_class.provider(:parsed)
- @keyfile = File.join(Dir.tmpdir, 'authorized_keys')
+ @keyfile = tmpfile('authorized_keys')
@provider.any_instance.stubs(:target).returns @keyfile
@user = 'random_bob'
Puppet::Util.stubs(:uid).with(@user).returns 12345
diff --git a/spec/unit/util/storage_spec.rb b/spec/unit/util/storage_spec.rb
index 6c8baba1f..ae3cbc2ae 100755
--- a/spec/unit/util/storage_spec.rb
+++ b/spec/unit/util/storage_spec.rb
@@ -3,15 +3,14 @@
require File.dirname(__FILE__) + '/../../spec_helper'
require 'yaml'
-require 'tempfile'
-
require 'puppet/util/storage'
describe Puppet::Util::Storage do
+ include PuppetSpec::Files
before(:all) do
@basepath = Puppet.features.posix? ? "/somepath" : "C:/somepath"
- Puppet[:statedir] = Dir.tmpdir
+ Puppet[:statedir] = tmpdir("statedir")
end
after(:all) do