Sha256: ca097e44f8310606d7c61c6c277a8a374a96ec429604141c293a8cef55fe5eb4

Contents?: true

Size: 863 Bytes

Versions: 2

Compression:

Stored size: 863 Bytes

Contents

require_relative 'test_helper'

# Unit Test for IOStreams::Gzip
module Streams
  class GzipReaderTest < Minitest::Test
    context IOStreams::Gzip::Reader do
      setup 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

      context '.open' do
        should 'file' do
          result = IOStreams::Gzip::Reader.open(@file_name) do |io|
            io.read
          end
          assert_equal @data, result
        end
        should '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

2 entries across 2 versions & 1 rubygems

Version Path
iostreams-0.8.0 test/gzip_reader_test.rb
iostreams-0.7.0 test/gzip_reader_test.rb