summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-04-24 12:41:16 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-04-24 12:41:16 -0700
commitb5814a70f2450ea37693e2704b039a6730aa7e87 (patch)
tree53de6981e8c90d7796c2be2cce2796619797052b
parent3bfd17a39c2ff3cdb76251e4ff327fee05376d44 (diff)
downloadpsych-b5814a70f2450ea37693e2704b039a6730aa7e87.zip
merge from ruby
-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