diff options
author | Luke Kanies <luke@madstop.com> | 2009-05-24 14:13:02 -0500 |
---|---|---|
committer | James Turnbull <james@ubuntu904.lovedthanlost.net> | 2009-05-26 13:43:39 +1000 |
commit | 6e824d8ca58c5d6f27a4cfcf44fad579a24133d4 (patch) | |
tree | 1678ac69287628323ea67457461463a2e0b0ea40 /spec/lib/puppet_spec/files.rb | |
parent | 1d69dbfd0351d3f4d23c15904061d98f8bf42ca6 (diff) | |
download | puppet-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/lib/puppet_spec/files.rb')
-rw-r--r-- | spec/lib/puppet_spec/files.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/lib/puppet_spec/files.rb b/spec/lib/puppet_spec/files.rb new file mode 100644 index 000000000..542ad6e28 --- /dev/null +++ b/spec/lib/puppet_spec/files.rb @@ -0,0 +1,9 @@ +# A support module for testing files. +module PuppetSpec::Files + def tmpfile(name) + source = Tempfile.new(name) + path = source.path + source.close! + path + end +end |