Permalink
Browse files

Goodbye, Tempfile, I hated you always.

Now uses Stud::Temporary. Much happier.
(Tempfile uses finalizers to remove files on disk during GC, which
messes things up if all you want is a temporary "path name" not a file
itself.)
  • Loading branch information...
1 parent a867107 commit 98bb44a5d9d9f4765fee29c6327c94dfbdf27890 @jordansissel committed Feb 5, 2014
Showing with 6 additions and 8 deletions.
  1. +6 −8 spec/fpm/package/rpm_spec.rb
@@ -3,6 +3,7 @@
require "fpm/package/rpm" # local
require "fpm/package/dir" # local
require "arr-pm/file" # gem 'arr-pm'
+require "stud/temporary" # gem 'stud'
if !program_in_path?("rpmbuild")
Cabin::Channel.get("rspec") \
@@ -112,8 +113,7 @@ def subject.render_template; @rpmspec = template("rpm.erb").result(binding); end
describe "#output", :if => program_in_path?("rpmbuild") do
context "package attributes" do
before :each do
- @target = Tempfile.new("fpm-test-rpm").path
- File.delete(@target)
+ @target = Stud::Temporary.pathname
subject.name = "name"
subject.version = "123"
subject.architecture = "all"
@@ -242,8 +242,7 @@ def subject.render_template; @rpmspec = template("rpm.erb").result(binding); end
context "package default attributes" do
before :each do
- @target = Tempfile.new("fpm-test-rpm").path
- File.delete(@target)
+ @target = Stud::Temporary.pathname
subject.name = "name"
subject.version = "123"
# Write the rpm out
@@ -315,8 +314,8 @@ def subject.render_template; @rpmspec = template("rpm.erb").result(binding); end
describe "regressions should not occur", :if => program_in_path?("rpmbuild") do
before :each do
- @target = Tempfile.new("fpm-test-rpm").path
- File.delete(@target)
+ @tempfile_handle =
+ @target = Stud::Temporary.pathname
subject.name = "name"
subject.version = "1.23"
end
@@ -396,8 +395,7 @@ def subject.render_template; @rpmspec = template("rpm.erb").result(binding); end
describe "#output with digest and compression settings", :if => program_in_path?("rpmbuild") do
context "bzip2/sha1" do
before :each do
- @target = Tempfile.new("fpm-test-rpm").path
- File.delete(@target)
+ @target = Stud::Temporary.pathname
subject.name = "name"
subject.version = "123"
subject.architecture = "all"

0 comments on commit 98bb44a

Please sign in to comment.