Commit f94b30a3 authored by Valery Sizov's avatar Valery Sizov

Fix backup restoration whith pre-existing wiki

parent 6b95c3f9
---
title: Fix backup restoration with pre-existing wiki
merge_request: 24394
author:
type: fixed
......@@ -96,6 +96,7 @@ module Backup
end
wiki = ProjectWiki.new(project)
wiki.repository.remove rescue nil
path_to_wiki_bundle = path_to_bundle(wiki)
if File.exist?(path_to_wiki_bundle)
......
......@@ -86,6 +86,22 @@ describe Backup::Repository do
expect(pool_repository.object_pool.exists?).to be(true)
end
end
it 'cleans existing repositories' do
wiki_repository_spy = spy(:wiki)
allow_next_instance_of(ProjectWiki) do |project_wiki|
allow(project_wiki).to receive(:repository).and_return(wiki_repository_spy)
end
expect_next_instance_of(Repository) do |repo|
expect(repo).to receive(:remove)
end
subject.restore
expect(wiki_repository_spy).to have_received(:remove)
end
end
describe '#empty_repo?' 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