test/tc_archive.rb in archive-tar-external-1.2.0 vs test/tc_archive.rb in archive-tar-external-1.2.1
- old
+ new
@@ -1,31 +1,26 @@
###############################################################################
# tc_archive.rb
#
-# Test suite for the archive-tarsimple package.
+# Test suite for the archive-tarsimple package. This test case should be
+# run via the 'rake test' Rake task.
###############################################################################
-base = File.basename(Dir.pwd)
-if base == 'test' || base =~ /archive-tar-external/i
- Dir.chdir('..') if base == 'test'
- $LOAD_PATH.unshift(Dir.pwd + '/lib')
- Dir.chdir('test') rescue nil
-end
-
require 'archive/tar_external'
require 'test/unit'
include Archive
class TC_Archive < Test::Unit::TestCase
def setup
+ Dir.chdir('test') unless File.basename(Dir.pwd) == 'test'
@t = Tar::External.new('test.tar')
@tar_name = 'test.tar'
@pattern = '*.txt'
@archive = 'temp.tar.gz'
end
def test_version
- assert_equal('1.2.0', Tar::External::VERSION)
+ assert_equal('1.2.1', Tar::External::VERSION)
end
def test_constructor
assert_nothing_raised{ Tar::External.new(@tar_name) }
assert_nothing_raised{ Tar::External.new(@tar_name, '*.txt') }
@@ -65,11 +60,11 @@
def test_create_archive_basic
assert_respond_to(@t, :create_archive)
assert_respond_to(@t, :create) # Alias
assert_raises(ArgumentError){ @t.create_archive }
- assert_raises(TarError){ @t.create_archive('*.blah') }
+ assert_raises(Tar::Error){ @t.create_archive('*.blah') }
assert_nothing_raised{ @t.create_archive(@pattern) }
assert(@t.create_archive(@pattern))
assert(File.exists?(@tar_name))
end
@@ -133,10 +128,10 @@
end
def test_extract_archive_advanced
@t.tar_program = 'gtar' if PLATFORM.match('solaris')
assert_nothing_raised{ @t.create('*.txt') }
- assert_raises(TarError){ @t.expand('blah.txt') }
+ assert_raises(Tar::Error){ @t.expand('blah.txt') }
assert_nothing_raised{ @t.extract_archive }
assert_nothing_raised{ @t.extract_archive('temp2.txt') }
end