summaryrefslogtreecommitdiff
path: root/spec/ruby/core/io/path_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/io/path_spec.rb')
-rw-r--r--spec/ruby/core/io/path_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/ruby/core/io/path_spec.rb b/spec/ruby/core/io/path_spec.rb
new file mode 100644
index 0000000000..8145c32f39
--- /dev/null
+++ b/spec/ruby/core/io/path_spec.rb
@@ -0,0 +1,14 @@
+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
+ 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