File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed
Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -412,11 +412,7 @@ def flush_deletes #:nodoc:
412412
413413 def copy_to_local_file ( style , local_dest_path )
414414 log ( "copying #{ path ( style ) } to local file #{ local_dest_path } " )
415- ::File . open ( local_dest_path , 'wb' ) do |local_file |
416- s3_object ( style ) . get do |chunk |
417- local_file . write ( chunk )
418- end
419- end
415+ s3_object ( style ) . download_file ( local_dest_path )
420416 rescue Aws ::Errors ::ServiceError => e
421417 warn ( "#{ e } - cannot copy #{ path ( style ) } to local file #{ local_dest_path } " )
422418 false
Original file line number Diff line number Diff line change @@ -443,26 +443,28 @@ def counter
443443 allow ( @dummy . avatar ) . to receive ( :s3_object ) . with ( :thumb ) . and_return ( @object )
444444 allow ( @object ) . to receive ( :get ) . and_yield ( @file . read )
445445 allow ( @object ) . to receive ( :exists? ) . and_return ( true )
446+ allow ( @object ) . to receive ( :download_file ) . with ( anything )
446447 end
447448
448449 it "uploads original" do
449450 expect ( @object ) . to receive ( :upload_file ) . with (
450451 anything ,
451452 content_type : "image/png" ,
452453 acl : :"public-read" ) . and_return ( true )
454+ @dummy . avatar . reprocess!
453455 expect ( @object ) . to receive ( :upload_file ) . with (
454456 anything ,
455- content_type : "image/jpeg " ,
457+ content_type : "image/png " ,
456458 acl : :"public-read" ) . and_return ( true )
457459 @dummy . avatar . reprocess!
458460 end
459461
460462 it "doesn't upload original" do
461463 expect ( @object ) . to receive ( :upload_file ) . with (
462464 anything ,
463- content_type : "image/jpeg " ,
465+ content_type : "image/png " ,
464466 acl : :"public-read" ) . and_return ( true )
465- @dummy . avatar . reprocess! ( :thumb )
467+ @dummy . avatar . reprocess!
466468 end
467469 end
468470
You can’t perform that action at this time.
0 commit comments