test/tc_read_file.rb in ucf-1.1.0 vs test/tc_read_file.rb in ucf-2.0.0

- old
+ new

@@ -1,6 +1,6 @@ -# Copyright (c) 2013, 2014 The University of Manchester, UK. +# Copyright (c) 2013-2015 The University of Manchester, UK. # # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -35,51 +35,53 @@ class TestReadFile < Test::Unit::TestCase # Check that the null file does not verify. def test_verify_null_file - assert_raise(Zip::ZipError) do + assert_raise(ZipContainer::Error) do UCF::File.verify!($file_null) end - refute(UCF::File.verify($file_null)) + assert_raise(ZipContainer::Error) do + UCF::File.verify?($file_null) + end end # Check that the empty ucf file does verify. def test_verify_empty_ucf - assert_nothing_raised(ZipContainer::MalformedContainerError, Zip::ZipError) do + assert_nothing_raised(ZipContainer::MalformedContainerError, ZipContainer::Error) do UCF::File.verify!($ucf_empty) end - assert(UCF::File.verify($ucf_empty)) + assert(UCF::File.verify?($ucf_empty)) end # Check that the example ucf file does verify. def test_verify_example_ucf - assert_nothing_raised(ZipContainer::MalformedContainerError, Zip::ZipError) do + assert_nothing_raised(ZipContainer::MalformedContainerError, ZipContainer::Error) do UCF::File.verify!($ucf_example) end - assert(UCF::File.verify($ucf_example)) + assert(UCF::File.verify?($ucf_example)) end # Check that the empty zip file does not verify. def test_verify_empty_zip assert_raise(ZipContainer::MalformedContainerError) do UCF::File.verify!($zip_empty) end - refute(UCF::File.verify($zip_empty)) + refute(UCF::File.verify?($zip_empty)) end # Check that a compressed mimetype file is detected. def test_verify_compressed_mimetype assert_raise(ZipContainer::MalformedContainerError) do UCF::File.verify!($ucf_compressed_mimetype) end - refute(UCF::File.verify($ucf_compressed_mimetype)) + refute(UCF::File.verify?($ucf_compressed_mimetype)) end # Check the raw mimetype bytes def test_raw_mimetypes empty_ucf = File.read($ucf_empty) @@ -89,10 +91,10 @@ assert_not_equal("application/epub+zip", compressed_mimetype[38..57]) end # Check reading files out of a ucf file and make sure we don't change it. def test_read_files_from_ucf - assert_nothing_raised(ZipContainer::MalformedContainerError, Zip::ZipError) do + assert_nothing_raised(ZipContainer::MalformedContainerError, ZipContainer::Error) do UCF::File.open($ucf_example) do |ucf| assert(ucf.on_disk?) refute(ucf.in_memory?) assert(ucf.file.exists?("greeting.txt"))