summaryrefslogtreecommitdiff
path: root/spec/ruby/core/io
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2022-12-08 18:19:53 +1300
committerGitHub <noreply@github.com>2022-12-08 18:19:53 +1300
commit6fd5d2dc003bda5ce0685abd2b975d7ac7079d46 (patch)
treea7cffd3b1b2f40b76511d785b5c00f3d35245ee6 /spec/ruby/core/io
parentb2764752b2bccb8e4574891d380d0f0a3d67add0 (diff)
Introduce `IO.new(..., path:)` and promote `File#path` to `IO#path`. (#6867)
Notes
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
Diffstat (limited to 'spec/ruby/core/io')
-rw-r--r--spec/ruby/core/io/path_spec.rb11
1 files changed, 11 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..51055673d7
--- /dev/null
+++ b/spec/ruby/core/io/path_spec.rb
@@ -0,0 +1,11 @@
+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|
+ IO.new(file.fileno, path: file.path, autoclose: false).path.should == file.path
+ end
+ end
+ end
+end