about summary refs log tree commit homepage
path: root/test/test_unix_connect.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_unix_connect.rb')
-rw-r--r--test/test_unix_connect.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/test_unix_connect.rb b/test/test_unix_connect.rb
index 007f422..60cb8c0 100644
--- a/test/test_unix_connect.rb
+++ b/test/test_unix_connect.rb
@@ -3,6 +3,7 @@ require 'io/nonblock'
 $-w = true
 require 'kgio'
 require 'tempfile'
+require 'tmpdir'
 
 class SubSocket < Kgio::Socket
   attr_accessor :foo
@@ -14,7 +15,8 @@ end
 class TestKgioUnixConnect < Test::Unit::TestCase
 
   def setup
-    tmp = Tempfile.new('kgio_unix_1')
+    @tmpdir = Dir.mktmpdir('kgio_unix_1')
+    tmp = Tempfile.new('kgio_unix_1', @tmpdir)
     @path = tmp.path
     File.unlink(@path)
     tmp.close rescue nil
@@ -25,6 +27,7 @@ class TestKgioUnixConnect < Test::Unit::TestCase
   def teardown
     @srv.close unless @srv.closed?
     File.unlink(@path)
+    FileUtils.remove_entry_secure(@tmpdir)
     Kgio.accept_cloexec = true
   end