Skip to content

Commit 59ac47e

Browse files
committed
Use File.open with block
1 parent e4b4d58 commit 59ac47e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

test/stdlib/FileTest_test.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ class FileTestSingletonTest < Test::Unit::TestCase
55

66
testing "singleton(::FileTest)"
77

8-
9-
def with_path_io(path: __FILE__, io: default=File.open(File.expand_path(__FILE__)), &block)
10-
with_path(path, &block)
11-
with_io(io, &block)
12-
ensure
13-
io.close if default
8+
def with_path_io(&block)
9+
with_path(__FILE__, &block)
10+
File.open(File.expand_path(__FILE__)) do |io|
11+
with_io(io, &block)
12+
end
1413
end
1514

1615
def test_blockdev?

0 commit comments

Comments
 (0)