summaryrefslogtreecommitdiff
path: root/test/psych/test_exception.rb
diff options
context:
space:
mode:
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 d54c7d4fbb..a9fe5c43d1 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