[前][次][番号順一覧][スレッド一覧]

ruby-changes:18328

From: nobu <ko1@a...>
Date: Sat, 25 Dec 2010 15:04:14 +0900 (JST)
Subject: [ruby-changes:18328] Ruby:r30351 (trunk): * test/csv/test_encodings.rb (TestEncodings#setup): fix evil test

nobu	2010-12-25 15:04:07 +0900 (Sat, 25 Dec 2010)

  New Revision: 30351

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30351

  Log:
    * test/csv/test_encodings.rb (TestEncodings#setup): fix evil test
      suite writing to the source directory.

  Modified files:
    trunk/ChangeLog
    trunk/test/csv/test_encodings.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 30350)
+++ ChangeLog	(revision 30351)
@@ -1,3 +1,8 @@
+Sat Dec 25 15:04:05 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* test/csv/test_encodings.rb (TestEncodings#setup): fix evil test
+	  suite writing to the source directory.
+
 Sat Dec 25 15:08:08 2010  KOSAKI Motohiro  <kosaki.motohiro@g...>
 
 	* ext/pty/pty.c (chfunc): Added rb_thread_atfork_before_exec().
Index: test/csv/test_encodings.rb
===================================================================
--- test/csv/test_encodings.rb	(revision 30350)
+++ test/csv/test_encodings.rb	(revision 30351)
@@ -13,11 +13,14 @@
 
 class TestEncodings < Test::Unit::TestCase
   def setup
-    @temp_csv_path = File.join(File.dirname(__FILE__), "temp.csv")
+    require 'tempfile'
+    @temp_csv_file = Tempfile.new(%w"test_csv. .csv")
+    @temp_csv_path = @temp_csv_file.path
+    @temp_csv_file.close
   end
   
   def teardown
-    File.unlink(@temp_csv_path) if File.exist? @temp_csv_path
+    @temp_csv_file.close!
   end
   
   ########################################

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]