Index: test/ruby/test_io.rb
===================================================================
--- test/ruby/test_io.rb	(revision 33943)
+++ test/ruby/test_io.rb	(working copy)
@@ -1854,7 +1854,7 @@ End
     return if /x86_64-linux/ !~ RUBY_PLATFORM # A binary form of struct flock depend on platform
 
     pad=0
-    Tempfile.open(self.class.name) do |f|
+    Tempfile.open2(self.class.name) do |f|
       r, w = IO.pipe
       pid = fork do
         r.close
@@ -1889,7 +1889,7 @@ End
     start = 12
     len = 34
     sysid = 0
-    Tempfile.open(self.class.name) do |f|
+    Tempfile.open2(self.class.name) do |f|
       r, w = IO.pipe
       pid = fork do
         r.close
@@ -1919,7 +1919,7 @@ End
   end
 
   def test_fcntl_dupfd
-    Tempfile.open(self.class.name) do |f|
+    Tempfile.open2(self.class.name) do |f|
       fd = f.fcntl(Fcntl::F_DUPFD, 63)
       begin
         assert_operator(fd, :>=, 63)
Index: test/rubygems/test_gem_format.rb
===================================================================
--- test/rubygems/test_gem_format.rb	(revision 33943)
+++ test/rubygems/test_gem_format.rb	(working copy)
@@ -30,7 +30,7 @@ class TestGemFormat < Gem::Package::TarT
   end
 
   def test_class_from_file_by_path_corrupt
-    Tempfile.open 'corrupt' do |io|
+    Tempfile.open2 'corrupt' do |io|
       data = Gem.gzip 'a' * 10
       io.write tar_file_header('metadata.gz', "\000x", 0644, data.length)
       io.write data
Index: test/rubygems/test_gem_package_tar_input.rb
===================================================================
--- test/rubygems/test_gem_package_tar_input.rb	(revision 33943)
+++ test/rubygems/test_gem_package_tar_input.rb	(working copy)
@@ -54,7 +54,7 @@ class TestGemPackageTarInput < Gem::Pack
   end
 
   def test_initialize_no_metadata_file
-    Tempfile.open 'no_meta' do |io|
+    Tempfile.open2 'no_meta' do |io|
       io.write tar_file_header('a', '', 0644, 1)
       io.write 'a'
       io.rewind
Index: test/rdoc/test_rdoc_rdoc.rb
===================================================================
--- test/rdoc/test_rdoc_rdoc.rb	(revision 33943)
+++ test/rdoc/test_rdoc_rdoc.rb	(working copy)
@@ -66,7 +66,7 @@ class TestRDocRDoc < MiniTest::Unit::Tes
     skip "Encoding not implemented" unless Object.const_defined? :Encoding
     @rdoc.options.encoding = Encoding::ISO_8859_1
 
-    Tempfile.open 'test.txt' do |io|
+    Tempfile.open2 'test.txt' do |io|
       io.write 'hi'
       io.rewind
 
@@ -149,7 +149,7 @@ class TestRDocRDoc < MiniTest::Unit::Tes
   end
 
   def test_setup_output_dir_exists_file
-    Tempfile.open 'test_rdoc_rdoc' do |tempfile|
+    Tempfile.open2 'test_rdoc_rdoc' do |tempfile|
       path = tempfile.path
 
       e = assert_raises RDoc::Error do
Index: test/psych/test_psych.rb
===================================================================
--- test/psych/test_psych.rb	(revision 33943)
+++ test/psych/test_psych.rb	(working copy)
@@ -64,7 +64,7 @@ class TestPsych < Psych::TestCase
 
   def test_dump_file
     hash = {'hello' => 'TGIF!'}
-    Tempfile.open('fun.yml') do |io|
+    Tempfile.open2('fun.yml') do |io|
       assert_equal io, Psych.dump(hash, io)
       io.rewind
       assert_equal Psych.dump(hash), io.read
