Sha256: 4ec0001197cce36126baf9286307535fc0959f956c1ba2334f78411d57632562

Contents?: true

Size: 893 Bytes

Versions: 9

Compression:

Stored size: 893 Bytes

Contents

require_relative 'test_helper'
require 'zip'

# Unit Test for IOStreams::Zip
module Streams
  class ZipReaderTest < Minitest::Test
    describe IOStreams::Zip::Reader do
      before do
        @file_name = File.join(File.dirname(__FILE__), 'files', 'text.zip')
        @zip_data  = File.open(@file_name, 'rb') { |f| f.read }
        @data      = Zip::File.open(@file_name) { |zip_file| zip_file.first.get_input_stream.read }
      end

      describe '.open' do
        it 'file' do
          result = IOStreams::Zip::Reader.open(@file_name) do |io|
            io.read
          end
          assert_equal @data, result
        end

        it 'stream' do
          result = File.open(@file_name) do |file|
            IOStreams::Zip::Reader.open(file) do |io|
              io.read
            end
          end
          assert_equal @data, result
        end
      end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
iostreams-0.14.0 test/zip_reader_test.rb
iostreams-0.13.0 test/zip_reader_test.rb
iostreams-0.12.1 test/zip_reader_test.rb
iostreams-0.12.0 test/zip_reader_test.rb
iostreams-0.11.0 test/zip_reader_test.rb
iostreams-0.10.1 test/zip_reader_test.rb
iostreams-0.10.0 test/zip_reader_test.rb
iostreams-0.9.1 test/zip_reader_test.rb
iostreams-0.9.0 test/zip_reader_test.rb