From a8ba9d4ee7f8bb09fda61b2e61946acfc694faef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Meny?= Date: Tue, 9 Aug 2022 17:44:35 +0100 Subject: [PATCH] Fix test checking zip entry maximum size --- spec/services/archive_storage_service_spec.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spec/services/archive_storage_service_spec.rb b/spec/services/archive_storage_service_spec.rb index 611e0b8ce..e4843dd91 100644 --- a/spec/services/archive_storage_service_spec.rb +++ b/spec/services/archive_storage_service_spec.rb @@ -50,9 +50,11 @@ RSpec.describe ArchiveStorageService do end it "raises an error if the file exists but is too large" do - allow(archive_service.archive) - content = archive_service.get_file_io(compressed_filepath) - expect(content.read).to eq(compressed_file.read) + archive = archive_service.instance_variable_get(:@archive) + allow(archive).to receive(:get_entry).and_return(Zip::Entry.new(nil, "", nil, nil, nil, nil, nil, 100_000_000, nil)) + + expect { archive_service.get_file_io(compressed_filepath) } + .to raise_error(RuntimeError, "File too large to be extracted") end it "raises an error of a file does not exist" do