summaryrefslogtreecommitdiffstats
path: root/spec/integration
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-05-24 14:13:02 -0500
committerJames Turnbull <james@ubuntu904.lovedthanlost.net>2009-05-26 13:43:39 +1000
commit6e824d8ca58c5d6f27a4cfcf44fad579a24133d4 (patch)
tree1678ac69287628323ea67457461463a2e0b0ea40 /spec/integration
parent1d69dbfd0351d3f4d23c15904061d98f8bf42ca6 (diff)
downloadpuppet-6e824d8ca58c5d6f27a4cfcf44fad579a24133d4.tar.gz
puppet-6e824d8ca58c5d6f27a4cfcf44fad579a24133d4.tar.xz
puppet-6e824d8ca58c5d6f27a4cfcf44fad579a24133d4.zip
Adding a Spec lib directory and moving tmpfile to it
We had a common pattern for creating a temporary file during integration tests, and this just makes that common pattern explicit by moving it to a module in the newly-created lib directory in the spec directory. We definitely don't want to go overboard in using libraries in our tests, but sometimes it gets a bit excessive to completely avoid them. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/integration')
-rwxr-xr-xspec/integration/type/file.rb9
-rwxr-xr-xspec/integration/type/tidy.rb9
-rwxr-xr-xspec/integration/util/settings.rb9
3 files changed, 9 insertions, 18 deletions
diff --git a/spec/integration/type/file.rb b/spec/integration/type/file.rb
index 87a478d54..ef0cd3924 100755
--- a/spec/integration/type/file.rb
+++ b/spec/integration/type/file.rb
@@ -2,13 +2,10 @@
require File.dirname(__FILE__) + '/../../spec_helper'
+require 'puppet_spec/files'
+
describe Puppet::Type.type(:file) do
- def tmpfile(name)
- source = Tempfile.new(name)
- path = source.path
- source.close!
- path
- end
+ include PuppetSpec::Files
describe "when recursing" do
def build_path(dir)
diff --git a/spec/integration/type/tidy.rb b/spec/integration/type/tidy.rb
index 50ec3d7a6..c2206f97d 100755
--- a/spec/integration/type/tidy.rb
+++ b/spec/integration/type/tidy.rb
@@ -2,13 +2,10 @@
require File.dirname(__FILE__) + '/../../spec_helper'
+require 'puppet_spec/files'
+
describe Puppet::Type.type(:tidy) do
- def tmpfile(name)
- source = Tempfile.new(name)
- path = source.path
- source.close!
- path
- end
+ include PuppetSpec::Files
# Testing #355.
it "should be able to remove dead links" do
diff --git a/spec/integration/util/settings.rb b/spec/integration/util/settings.rb
index d2fe86892..146b988fd 100755
--- a/spec/integration/util/settings.rb
+++ b/spec/integration/util/settings.rb
@@ -2,13 +2,10 @@
require File.dirname(__FILE__) + '/../../spec_helper'
+require 'puppet_spec/files'
+
describe Puppet::Util::Settings do
- def tmpfile(name)
- source = Tempfile.new(name)
- path = source.path
- source.close!
- path
- end
+ include PuppetSpec::Files
it "should be able to make needed directories" do
settings = Puppet::Util::Settings.new