From fe67998816245fbab6a65095bde3d57f1277609c Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 9 Dec 2022 22:15:38 +0900 Subject: [PATCH] Clean up a temporary file --- spec/ruby/core/io/path_spec.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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