summaryrefslogtreecommitdiff
path: root/spec/ruby/core/io
diff options
context:
space:
mode:
authorAndrew Konchin <andry.konchin@gmail.com>2025-07-09 14:44:55 +0300
committerBenoit Daloze <eregontp@gmail.com>2025-07-09 15:11:17 +0200
commit087387794a468be4e69960c7831e15cd363a508a (patch)
treec1a103646128c2674707a03588826cfc3f9ab417 /spec/ruby/core/io
parentba246c5a16c77cc7ade1498bdeeae8835713d931 (diff)
Update to ruby/spec@ed254ba
Diffstat (limited to 'spec/ruby/core/io')
-rw-r--r--spec/ruby/core/io/popen_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/ruby/core/io/popen_spec.rb b/spec/ruby/core/io/popen_spec.rb
index e9d32c5c7d..6043862614 100644
--- a/spec/ruby/core/io/popen_spec.rb
+++ b/spec/ruby/core/io/popen_spec.rb
@@ -95,6 +95,22 @@ describe "IO.popen" do
@io = IO.popen(ruby_cmd('exit 0'), mode)
end
+ it "accepts a path using the chdir: keyword argument" do
+ path = File.dirname(@fname)
+
+ @io = IO.popen(ruby_cmd("puts Dir.pwd"), "r", chdir: path)
+ @io.read.chomp.should == path
+ end
+
+ it "accepts a path using the chdir: keyword argument and a coercible path" do
+ path = File.dirname(@fname)
+ object = mock("path")
+ object.should_receive(:to_path).and_return(path)
+
+ @io = IO.popen(ruby_cmd("puts Dir.pwd"), "r", chdir: object)
+ @io.read.chomp.should == path
+ end
+
describe "with a block" do
it "yields an open IO to the block" do
IO.popen(ruby_cmd('exit'), "r") do |io|