Skip to content

Commit 12e3d03

Browse files
authored
Store tempfile objects to prevent deletion during tests (#555)
1 parent 735b083 commit 12e3d03

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/units/test_archive.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@ class TestArchive < Test::Unit::TestCase
77
def setup
88
set_file_paths
99
@git = Git.open(@wdir)
10+
@tempfiles = []
11+
end
12+
13+
def teardown
14+
@tempfiles.clear
1015
end
1116

1217
def tempfile
1318
tempfile_object = Tempfile.new('archive-test')
19+
@tempfiles << tempfile_object # prevent deletion until teardown
1420
tempfile_object.close # close to avoid locking from git processes
1521
tempfile_object.path
1622
end

0 commit comments

Comments
 (0)