summaryrefslogtreecommitdiff
path: root/test/psych
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-24 12:07:53 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-24 12:07:53 +0000
commit0e5546df901d15381d4ec08af11971c649a7c308 (patch)
tree228316aece9f150977b19755442fbb33bca25790 /test/psych
parentba2ee2f04c72b224ea167ee2366623fa2d05f65c (diff)
* test/psych/test_psych.rb: don't leave temporary files.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/psych')
-rw-r--r--test/psych/test_psych.rb20
1 files changed, 12 insertions, 8 deletions
diff --git a/test/psych/test_psych.rb b/test/psych/test_psych.rb
index 78f022c..4f78ea9 100644
--- a/test/psych/test_psych.rb
+++ b/test/psych/test_psych.rb
@@ -83,17 +83,21 @@ class TestPsych < Psych::TestCase
end
def test_load_file
- name = File.join(Dir.tmpdir, 'yikes.yml')
- File.open(name, 'wb') { |f| f.write('--- hello world') }
-
- assert_equal 'hello world', Psych.load_file(name)
+ t = Tempfile.new(['yikes', 'yml'])
+ t.binmode
+ t.write('--- hello world')
+ t.close
+ assert_equal 'hello world', Psych.load_file(t.path)
+ t.close(true)
end
def test_parse_file
- name = File.join(Dir.tmpdir, 'yikes.yml')
- File.open(name, 'wb') { |f| f.write('--- hello world') }
-
- assert_equal 'hello world', Psych.parse_file(name).transform
+ t = Tempfile.new(['yikes', 'yml'])
+ t.binmode
+ t.write('--- hello world')
+ t.close
+ assert_equal 'hello world', Psych.parse_file(t.path).transform
+ t.close(true)
end
def test_degenerate_strings