summaryrefslogtreecommitdiff
path: root/spec/ruby/core/io
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-12-09 22:15:38 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-12-09 22:15:38 +0900
commitfe67998816245fbab6a65095bde3d57f1277609c (patch)
tree9db371707c1ef0f02de2c685e20eb77a555d6d95 /spec/ruby/core/io
parent11acb7f7bcf6e80e03cf83bba863b9b3f980fdca (diff)
Clean up a temporary file
Diffstat (limited to 'spec/ruby/core/io')
-rw-r--r--spec/ruby/core/io/path_spec.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/spec/ruby/core/io/path_spec.rb b/spec/ruby/core/io/path_spec.rb
index 51055673d7..8145c32f39 100644
--- a/spec/ruby/core/io/path_spec.rb
+++ b/spec/ruby/core/io/path_spec.rb
@@ -3,9 +3,12 @@ require_relative '../../spec_helper'
describe "IO#path" do
ruby_version_is "3.2" do
it "returns the path of the file associated with the IO object" do
- File.open(tmp("io_path.txt"), "w") do |file|
+ path = tmp("io_path.txt")
+ File.open(path, "w") do |file|
IO.new(file.fileno, path: file.path, autoclose: false).path.should == file.path
end
+ ensure
+ File.unlink(path)
end
end
end