summaryrefslogtreecommitdiff
path: root/spec/unit/file_system/tempfile_spec.rb
diff options
context:
space:
mode:
authorStig Sandbeck Mathisen <ssm@debian.org>2014-09-07 10:14:36 +0200
committerStig Sandbeck Mathisen <ssm@debian.org>2014-09-07 10:14:36 +0200
commitd4b83be375ac1dead058e091191ee7c7b7c24c8a (patch)
treedc825687392ae3068de5b764be60c53122d9e02a /spec/unit/file_system/tempfile_spec.rb
parent229cbb976fe0f70f5f30548b83517b415840f9bb (diff)
parent1681684857c6e39d60d87b0b3520d8783977ceff (diff)
downloadpuppet-d4b83be375ac1dead058e091191ee7c7b7c24c8a.tar.gz
Imported Upstream version 3.7.0upstream/3.7.0
Diffstat (limited to 'spec/unit/file_system/tempfile_spec.rb')
-rw-r--r--spec/unit/file_system/tempfile_spec.rb48
1 files changed, 0 insertions, 48 deletions
diff --git a/spec/unit/file_system/tempfile_spec.rb b/spec/unit/file_system/tempfile_spec.rb
deleted file mode 100644
index eb13b0406..000000000
--- a/spec/unit/file_system/tempfile_spec.rb
+++ /dev/null
@@ -1,48 +0,0 @@
-require 'spec_helper'
-
-describe Puppet::FileSystem::Tempfile do
- it "makes the name of the file available" do
- Puppet::FileSystem::Tempfile.open('foo') do |file|
- expect(file.path).to match(/foo/)
- end
- end
-
- it "provides a writeable file" do
- Puppet::FileSystem::Tempfile.open('foo') do |file|
- file.write("stuff")
- file.flush
-
- expect(Puppet::FileSystem.read(file.path)).to eq("stuff")
- end
- end
-
- it "returns the value of the block" do
- the_value = Puppet::FileSystem::Tempfile.open('foo') do |file|
- "my value"
- end
-
- expect(the_value).to eq("my value")
- end
-
- it "unlinks the temporary file" do
- filename = Puppet::FileSystem::Tempfile.open('foo') do |file|
- file.path
- end
-
- expect(Puppet::FileSystem.exist?(filename)).to be_false
- end
-
- it "unlinks the temporary file even if the block raises an error" do
- filename = nil
-
- begin
- Puppet::FileSystem::Tempfile.open('foo') do |file|
- filename = file.path
- raise "error!"
- end
- rescue
- end
-
- expect(Puppet::FileSystem.exist?(filename)).to be_false
- end
-end