File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,7 +35,10 @@ def prepare!
3535 @state = :start
3636 @download_url = nil
3737 @offset = 0
38- if download_dest . respond_to? ( :write )
38+ if @download_dest . is_a? ( Pathname )
39+ @download_io = File . open ( download_dest , 'wb' )
40+ @close_io_on_finish = true
41+ elsif download_dest . respond_to? ( :write )
3942 @download_io = download_dest
4043 @close_io_on_finish = false
4144 elsif download_dest . is_a? ( String )
Original file line number Diff line number Diff line change @@ -135,4 +135,14 @@ def write(data)
135135 end
136136 end
137137 end
138+
139+ context 'with pathname destination' do
140+ let ( :dest ) { Pathname . new ( File . join ( Dir . mktmpdir , 'test-path.txt' ) ) }
141+ let ( :received ) do
142+ command . execute ( client )
143+ File . read ( dest )
144+ end
145+
146+ include_examples 'should download'
147+ end
138148end
You can’t perform that action at this time.
0 commit comments