Commit 3aec75d0 authored by Vladimir Shushlin's avatar Vladimir Shushlin

Remove pages archive in case of exception

parent e06ca006
......@@ -26,6 +26,9 @@ module Pages
end
[output_file, count]
rescue => e
FileUtils.rm_f(output_file) if output_file
raise e
end
private
......
......@@ -24,8 +24,10 @@ RSpec.describe Pages::ZipDirectoryService do
let(:archive) { result.first }
let(:entries_count) { result.second }
it 'raises error if there is no public directory' do
it 'raises error if there is no public directory and does not leave archive' do
expect { archive }.to raise_error(described_class::InvalidArchiveError)
expect(File.exist?(File.join(@work_dir, '@migrated.zip'))).to eq(false)
end
it 'raises error if public directory is a symlink' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment