test/zip_writer_test.rb in iostreams-1.0.0.beta5 vs test/zip_writer_test.rb in iostreams-1.0.0.beta6
- old
+ new
@@ -22,29 +22,20 @@
describe '.file' do
it 'file' do
IOStreams::Zip::Writer.file(file_name, entry_file_name: 'text.txt') do |io|
io.write(decompressed)
end
- result = ::Zip::File.open(file_name) do |zip_file|
- zip_file.first.get_input_stream.read
- end
+ result = IOStreams::Zip::Reader.file(file_name, &:read)
assert_equal decompressed, result
end
it 'stream' do
io_string = StringIO.new(''.b)
IOStreams::Zip::Writer.stream(io_string) do |io|
io.write(decompressed)
end
io = StringIO.new(io_string.string)
- result = nil
- begin
- zin = ::Zip::InputStream.new(io)
- zin.get_next_entry
- result = zin.read
- ensure
- zin.close if zin
- end
+ result = IOStreams::Zip::Reader.stream(io, &:read)
assert_equal decompressed, result
end
end
end
end