aboutsummaryrefslogtreecommitdiffstats
path: root/test/helpers/test_accessing_files.rb
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2025-11-26 19:02:46 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2025-11-26 19:02:46 -0500
commitc77a15eed515fe6dc9b2e831670f4d484e23dace (patch)
tree87c79155c0b52b0e59eaf971f2b5bf9d860c77e4 /test/helpers/test_accessing_files.rb
parent537c7673bedbb1a2f77a3a088710546cb46506d0 (diff)
parentc62f8376a13e7a4f493167aba1c66a9201fc59c6 (diff)
Update upstream source from tag 'upstream/3.0.0'
Update to upstream version '3.0.0' with Debian dir ceed7b02bc1417ad11993c466d2350a6b62fbecf
Diffstat (limited to 'test/helpers/test_accessing_files.rb')
-rw-r--r--test/helpers/test_accessing_files.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/helpers/test_accessing_files.rb b/test/helpers/test_accessing_files.rb
index 8732bc8..5cccf27 100644
--- a/test/helpers/test_accessing_files.rb
+++ b/test/helpers/test_accessing_files.rb
@@ -36,6 +36,27 @@ module TestAccesingFiles
end
end
+ def test_finalize_twice
+ skip if defined? JRUBY_VERSION
+
+ instance = Class.new { include Roo::Tempdir }.new
+
+ tempdir = instance.make_tempdir(instance, "my_temp_prefix", nil)
+ assert File.exist?(tempdir), "Expected #{tempdir} to initially exist"
+
+ pid = Process.fork do
+ # Inside the forked process finalize does not affect the parent process's state, but does
+ # delete the tempfile on disk
+ instance.finalize_tempdirs(instance.object_id)
+ end
+
+ Process.wait(pid)
+ refute File.exist?(tempdir), "Expected #{tempdir} to have been cleaned up by child process"
+
+ instance.finalize_tempdirs(instance.object_id)
+ refute File.exist?(tempdir), "Expected #{tempdir} to still have been cleaned up"
+ end
+
def test_cleanup_on_error
# NOTE: This test was occasionally failing because when it started running
# other tests would have already added folders to the temp directory,