Add test case for Tempfile input

This commit is contained in:
joker1007 2016-01-06 14:29:58 +09:00
parent df07478009
commit da53defdc8
1 changed files with 14 additions and 0 deletions

View File

@ -129,6 +129,20 @@ RSpec.describe Google::Apis::Core::RawUploadCommand do
end end
end end
context('with Tempfile input') do
let(:file) do
temp_file = Tempfile.new
temp_file.write("Hello world\n")
temp_file.rewind
temp_file
end
include_examples 'should upload'
it 'should not close stream' do
expect(file.closed?).to be false
end
end
context('with file path input') do context('with file path input') do
let(:file) { File.join(FIXTURES_DIR, 'files', 'test.txt') } let(:file) { File.join(FIXTURES_DIR, 'files', 'test.txt') }
include_examples 'should upload' include_examples 'should upload'