summaryrefslogtreecommitdiff
path: root/test/psych/test_exception.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-05-14 09:59:02 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-05-14 09:59:02 -0700
commit53cda3d62cc4ed2620328a871c0a0cf9fcee64f5 (patch)
treea4c13c94ac3696b23a09d22543ae9d066ca2072b /test/psych/test_exception.rb
parentf49cd992654a51b15187a7649afa166cc745e9da (diff)
downloadpsych-53cda3d62cc4ed2620328a871c0a0cf9fcee64f5.zip
merging from Ruby
Diffstat (limited to 'test/psych/test_exception.rb')
-rw-r--r--test/psych/test_exception.rb39
1 files changed, 19 insertions, 20 deletions
diff --git a/test/psych/test_exception.rb b/test/psych/test_exception.rb
index d54c7d4..a9fe5c4 100644
--- a/test/psych/test_exception.rb
+++ b/test/psych/test_exception.rb
@@ -56,27 +56,27 @@ module Psych
end
def test_parse_file_exception
- t = Tempfile.new(['parsefile', 'yml'])
- t.binmode
- t.write '--- `'
- t.close
- ex = assert_raises(Psych::SyntaxError) do
- Psych.parse_file t.path
- end
- assert_equal t.path, ex.file
- t.close(true)
+ Tempfile.create(['parsefile', 'yml']) {|t|
+ t.binmode
+ t.write '--- `'
+ t.close
+ ex = assert_raises(Psych::SyntaxError) do
+ Psych.parse_file t.path
+ end
+ assert_equal t.path, ex.file
+ }
end
def test_load_file_exception
- t = Tempfile.new(['loadfile', 'yml'])
- t.binmode
- t.write '--- `'
- t.close
- ex = assert_raises(Psych::SyntaxError) do
- Psych.load_file t.path
- end
- assert_equal t.path, ex.file
- t.close(true)
+ Tempfile.create(['loadfile', 'yml']) {|t|
+ t.binmode
+ t.write '--- `'
+ t.close
+ ex = assert_raises(Psych::SyntaxError) do
+ Psych.load_file t.path
+ end
+ assert_equal t.path, ex.file
+ }
end
def test_psych_parse_takes_file
@@ -128,7 +128,7 @@ module Psych
end
def test_psych_syntax_error
- Tempfile.open(['parsefile', 'yml']) do |t|
+ Tempfile.create(['parsefile', 'yml']) do |t|
t.binmode
t.write '--- `'
t.close
@@ -138,7 +138,6 @@ module Psych
rescue StandardError
assert true # count assertion
ensure
- t.close(true)
return unless $!
ancestors = $!.class.ancestors.inspect