Sha256: 369b748b61c604e7d6b88029aa90a60aa5e1ab853c66e4c5ea747da33628df32

Contents?: true

Size: 712 Bytes

Versions: 1

Compression:

Stored size: 712 Bytes

Contents

require_relative 'minitest_helper'

class TestTarIntegration < MiniTest::Unit::TestCase

  def tar(path = "#{samples_path}/tar_with_directory.tar")
    @tar ||= Swathe::Tar.open(path)
  end

  def test_is_a_tar
    assert tar.tar?
  end

  def test_file_count
    assert_equal 1, tar.files.count
  end

  def test_file_list
    assert_equal ["samples/file.txt"], tar.files.collect(&:full_name)
  end

  def test_directory_list
    assert_equal ["samples/"], tar.directories.collect(&:full_name)
  end

  def test_read_file
    assert_match %r(This is a sample file to test extraction), tar.entry('samples/file.txt').read
  end

  def test_extractor
    assert_kind_of Swathe::Extractor, tar.extractor
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
swathe-0.0.1 test/tar_test.rb