File tree Expand file tree Collapse file tree 4 files changed +12
-6
lines changed
spec/cloud_storage/wrappers Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ def size
1313 @internal . size
1414 end
1515
16- def download ( local_file = Tempfile . new )
16+ def download ( local_file = Tempfile . new ( 'cloud' , binmode : true ) )
1717 internal_download ( local_file ) . tap ( &:rewind )
1818 end
1919
Original file line number Diff line number Diff line change 11# frozen_string_literal: true
22
33module CloudStorage
4- VERSION = '0.1.0 '
4+ VERSION = '0.1.1 '
55end
Original file line number Diff line number Diff line change 148148 context 'when file exists' do
149149 let ( :file ) { File . open ( 'spec/fixtures/test.txt' , 'rb' ) }
150150 let! ( :obj ) { cli . upload_file ( key : 'test5.txt' , file : file ) }
151+ let ( :tmp ) { cli . find ( 'test5.txt' ) . download }
151152
152153 after do
153154 file . close
154155
155156 obj . delete!
157+
158+ tmp . close
159+ tmp . unlink
156160 end
157161
158162 it do
159- expect ( cli . find ( 'test5.txt' ) . download . read ) . to eq ( "This is a test upload\n " )
163+ expect ( tmp . read ) . to eq ( "This is a test upload\n " )
160164 end
161165 end
162166
Original file line number Diff line number Diff line change 141141 context 'when file exists' do
142142 let ( :file ) { File . open ( 'spec/fixtures/test.txt' , 'rb' ) }
143143 let! ( :obj ) { cli . upload_file ( key : 'test5.txt' , file : file ) }
144+ let ( :tmp ) { cli . find ( 'test5.txt' ) . download }
144145
145146 after do
146147 file . close
147148
148149 obj . delete!
149- end
150150
151- it do
152- expect ( cli . find ( 'test5.txt' ) . download . read ) . to eq ( "This is a test upload \n " )
151+ tmp . close
152+ tmp . unlink
153153 end
154+
155+ it { expect ( tmp . read ) . to eq ( "This is a test upload\n " ) }
154156 end
155157
156158 context 'when file does not exists' do
You can’t perform that action at this time.
0 commit comments