Sha256: cdbf514409f0820312a462215a1a4cfe6e161bfe5d6e5e4597afafb8de1ebfe6

Contents?: true

Size: 859 Bytes

Versions: 9

Compression:

Stored size: 859 Bytes

Contents

require_relative 'test_helper'

# Unit Test for IOStreams::Gzip
module Streams
  class GzipReaderTest < Minitest::Test
    describe IOStreams::Gzip::Reader do
      before do
        @file_name = File.join(File.dirname(__FILE__), 'files', 'text.txt.gz')
        @gzip_data = File.open(@file_name, 'rb') { |f| f.read }
        @data      = Zlib::GzipReader.open(@file_name) { |gz| gz.read }
      end

      describe '.open' do
        it 'file' do
          result = IOStreams::Gzip::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::Gzip::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/gzip_reader_test.rb
iostreams-0.13.0 test/gzip_reader_test.rb
iostreams-0.12.1 test/gzip_reader_test.rb
iostreams-0.12.0 test/gzip_reader_test.rb
iostreams-0.11.0 test/gzip_reader_test.rb
iostreams-0.10.1 test/gzip_reader_test.rb
iostreams-0.10.0 test/gzip_reader_test.rb
iostreams-0.9.1 test/gzip_reader_test.rb
iostreams-0.9.0 test/gzip_reader_test.rb