summaryrefslogtreecommitdiff
path: root/test/open-uri
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-08-24 14:08:37 +0900
committergit <svn-admin@ruby-lang.org>2023-08-24 05:14:56 +0000
commitfbe7962b54096d52d15d31756db80cf5cca5ea98 (patch)
treec88c7d86f8b89122904ff5c56c54bb19c5d54f4a /test/open-uri
parent7e0d2c614341521a958f84adbeca738c6824f222 (diff)
[ruby/open-uri] Close leaked files
https://github.com/ruby/open-uri/commit/c52ee9e430
Diffstat (limited to 'test/open-uri')
-rw-r--r--test/open-uri/test_open-uri.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/open-uri/test_open-uri.rb b/test/open-uri/test_open-uri.rb
index 8c8f75ce03..86aefc52c8 100644
--- a/test/open-uri/test_open-uri.rb
+++ b/test/open-uri/test_open-uri.rb
@@ -173,9 +173,12 @@ class TestOpenURI < Test::Unit::TestCase
end
def test_pass_keywords
- require 'tempfile'
- t = Tempfile.new
- assert_kind_of File, URI.open(Tempfile.new.path, mode: 0666)
+ begin
+ f = URI.open(File::NULL, mode: 0666)
+ assert_kind_of File, f
+ ensure
+ f&.close
+ end
o = Object.new
def o.open(foo: ) foo end