File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change 96
96
end
97
97
98
98
it "accepts a path using the chdir: keyword argument" do
99
- File . write ( @fname , 'hello world' )
100
- @io = IO . popen ( "/bin/ls" , chdir : File . dirname ( @fname ) ) ;
101
- @io . read . chomp . should == File . basename ( @fname )
99
+ path = File . dirname ( @fname )
100
+
101
+ @io = IO . popen ( ruby_cmd ( "puts Dir.pwd" ) , "r" , chdir : path )
102
+ @io . read . chomp . should == path
102
103
end
103
104
104
105
it "accepts a path using the chdir: keyword argument and a coercible path" do
105
- path = mock ( "path" )
106
- path . should_receive ( :to_path ) . and_return ( File . dirname ( @fname ) )
107
- File . write ( @fname , 'hello world' )
108
- @io = IO . popen ( "/bin/ls" , chdir : path ) ;
109
- @io . read . chomp . should == File . basename ( @fname )
106
+ path = File . dirname ( @fname )
107
+ object = mock ( "path" )
108
+ object . should_receive ( :to_path ) . and_return ( path )
109
+
110
+ @io = IO . popen ( ruby_cmd ( "puts Dir.pwd" ) , "r" , chdir : object )
111
+ @io . read . chomp . should == path
110
112
end
111
113
112
114
describe "with a block" do
You can’t perform that action at this time.
0 commit comments