Sha256: 72e6f6fdce7d10fde6a8a9023475a40dd854f79f55769b2dbabc5331bf5c4a5c

Contents?: true

Size: 725 Bytes

Versions: 9

Compression:

Stored size: 725 Bytes

Contents

require_relative 'test_helper'

class GzipReaderTest < Minitest::Test
  describe IOStreams::Gzip::Reader do
    let :file_name do
      File.join(File.dirname(__FILE__), 'files', 'text.txt.gz')
    end

    let :decompressed do
      Zlib::GzipReader.open(file_name) { |gz| gz.read }
    end

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

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

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
iostreams-1.1.0 test/gzip_reader_test.rb
iostreams-1.0.0 test/gzip_reader_test.rb
iostreams-1.0.0.beta7 test/gzip_reader_test.rb
iostreams-1.0.0.beta6 test/gzip_reader_test.rb
iostreams-1.0.0.beta5 test/gzip_reader_test.rb
iostreams-1.0.0.beta4 test/gzip_reader_test.rb
iostreams-1.0.0.beta3 test/gzip_reader_test.rb
iostreams-1.0.0.beta2 test/gzip_reader_test.rb
iostreams-1.0.0.beta test/gzip_reader_test.rb