add tests for UploadIO#from_io
This commit is contained in:
		
							parent
							
								
									8daeb2cc1e
								
							
						
					
					
						commit
						0cc3a1f814
					
				| 
						 | 
				
			
			@ -22,6 +22,7 @@ require 'hurley/test'
 | 
			
		|||
# TODO: Upload from file
 | 
			
		||||
 | 
			
		||||
RSpec.describe Google::Apis::Core::UploadIO do
 | 
			
		||||
  context 'from_file' do
 | 
			
		||||
    let(:upload_io) { Google::Apis::Core::UploadIO.from_file(file) }
 | 
			
		||||
 | 
			
		||||
    context 'with text file' do
 | 
			
		||||
| 
						 | 
				
			
			@ -49,6 +50,25 @@ RSpec.describe Google::Apis::Core::UploadIO do
 | 
			
		|||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  context 'from_io' do
 | 
			
		||||
 | 
			
		||||
    context 'with i/o stream' do
 | 
			
		||||
      let(:io) { StringIO.new 'Hello google' }
 | 
			
		||||
      
 | 
			
		||||
      it 'should setup default content-type' do
 | 
			
		||||
        upload_io = Google::Apis::Core::UploadIO.from_io(io)  
 | 
			
		||||
        expect(upload_io.content_type).to eql Google::Apis::Core::UploadIO::OCTET_STREAM_CONTENT_TYPE
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it 'should allow overring the mime type' do
 | 
			
		||||
        upload_io = Google::Apis::Core::UploadIO.from_io(io, content_type: 'application/x-gzip')
 | 
			
		||||
        expect(upload_io.content_type).to eq('application/x-gzip')
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
RSpec.describe Google::Apis::Core::RawUploadCommand do
 | 
			
		||||
  include TestHelpers
 | 
			
		||||
  include_context 'HTTP client'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue