diff options
author | Benoit Daloze <eregontp@gmail.com> | 2020-08-29 12:17:07 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2020-08-29 12:23:23 +0200 |
commit | e8c3872555fc85640505974e6b1c39d315572689 (patch) | |
tree | d3efaa93985db2932c57d15729d18e3c0e1ca2d6 /test/rdoc/test_rdoc_rdoc.rb | |
parent | ff323b2a5c56cdec93900af4d67f3811f946d9b8 (diff) |
Simplify Tempfile.open calls with a block as they now unlink the file automatically
Diffstat (limited to 'test/rdoc/test_rdoc_rdoc.rb')
-rw-r--r-- | test/rdoc/test_rdoc_rdoc.rb | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/test/rdoc/test_rdoc_rdoc.rb b/test/rdoc/test_rdoc_rdoc.rb index f2cc901283..782409987a 100644 --- a/test/rdoc/test_rdoc_rdoc.rb +++ b/test/rdoc/test_rdoc_rdoc.rb @@ -342,16 +342,14 @@ class TestRDocRDoc < RDoc::TestCase @rdoc.options.encoding = Encoding::ISO_8859_1 @rdoc.store = RDoc::Store.new - tf = Tempfile.open 'test.txt' do |io| + Tempfile.open 'test.txt' do |io| io.write 'hi' io.rewind top_level = @rdoc.parse_file io.path assert_equal Encoding::ISO_8859_1, top_level.absolute_name.encoding - io end - tf.close! end def test_parse_file_forbidden @@ -360,7 +358,7 @@ class TestRDocRDoc < RDoc::TestCase @rdoc.store = RDoc::Store.new - tf = Tempfile.open 'test.txt' do |io| + Tempfile.open 'test.txt' do |io| io.write 'hi' io.rewind @@ -379,9 +377,7 @@ class TestRDocRDoc < RDoc::TestCase ensure File.chmod 0400, io.path end - io end - tf.close! end def test_remove_unparseable @@ -478,7 +474,7 @@ class TestRDocRDoc < RDoc::TestCase end def test_setup_output_dir_exists_file - tf = Tempfile.open 'test_rdoc_rdoc' do |tempfile| + Tempfile.open 'test_rdoc_rdoc' do |tempfile| path = tempfile.path e = assert_raise RDoc::Error do @@ -487,9 +483,7 @@ class TestRDocRDoc < RDoc::TestCase assert_match(%r%#{Regexp.escape path} exists and is not a directory%, e.message) - tempfile end - tf.close! end def test_setup_output_dir_exists_not_rdoc |