Merge pull request #298 from hainesr/cleanup-post-tests

Clean up empty.zip after running tests.
This commit is contained in:
Alexander Simonov 2016-11-09 22:16:24 +02:00 committed by GitHub
commit fdc7a50e89
2 changed files with 5 additions and 2 deletions

View File

@ -528,9 +528,8 @@ class ZipFileTest < MiniTest::Test
end
def test_empty_zip
puts `touch empty.zip`
assert_raises(::Zip::Error) do
::Zip::File.open('empty.zip')
::Zip::File.open(TestFiles::NULL_FILE)
end
end

View File

@ -9,6 +9,8 @@ class TestFiles
RANDOM_BINARY_FILE1 = 'test/data/generated/randomBinary1.bin'
RANDOM_BINARY_FILE2 = 'test/data/generated/randomBinary2.bin'
NULL_FILE = 'test/data/generated/null.zip' # Zero length, so not a zip file.
EMPTY_TEST_DIR = 'test/data/generated/emptytestdir'
ASCII_TEST_FILES = [RANDOM_ASCII_FILE1, RANDOM_ASCII_FILE2, RANDOM_ASCII_FILE3]
@ -28,6 +30,8 @@ class TestFiles
create_random_binary(filename, 1E4 * (index + 1))
end
system("touch #{NULL_FILE}")
ensure_dir(EMPTY_TEST_DIR)
end