Sha256: 40c1718f7ace41a9dc588b9d6be94080e7ee89fba6ff1d439fbdbaa8cf689bcc

Contents?: true

Size: 879 Bytes

Versions: 1

Compression:

Stored size: 879 Bytes

Contents

require_relative 'test_helper'

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

      describe '.open' do
        it 'file' do
          result = IOStreams::Bzip2::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::Bzip2::Reader.open(file) do |io|
              io.read
            end
          end
          assert_equal @data, result
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
iostreams-0.14.0 test/bzip2_reader_test.rb