Merge pull request #270 from rusikf/patch-2
add tests for UploadIO#from_io
This commit is contained in:
commit
e36e68ee2a
|
@ -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
|
||||
|
@ -47,6 +48,25 @@ RSpec.describe Google::Apis::Core::UploadIO do
|
|||
expect(io.content_type).to eql('application/json')
|
||||
end
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue