diff options
Diffstat (limited to 'spec/lib/gitlab/import_export/snippet_repo_restorer_spec.rb')
-rw-r--r-- | spec/lib/gitlab/import_export/snippet_repo_restorer_spec.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/spec/lib/gitlab/import_export/snippet_repo_restorer_spec.rb b/spec/lib/gitlab/import_export/snippet_repo_restorer_spec.rb index 3ce950d6a64..779b65e33d8 100644 --- a/spec/lib/gitlab/import_export/snippet_repo_restorer_spec.rb +++ b/spec/lib/gitlab/import_export/snippet_repo_restorer_spec.rb @@ -25,16 +25,24 @@ describe Gitlab::ImportExport::SnippetRepoRestorer do expect(snippet.repository_exists?).to be_falsey aggregate_failures do - expect(restorer.restore).to be_truthy - - expect(snippet.repository_exists?).to be_truthy - expect(snippet.snippet_repository).not_to be_nil + expect do + expect(restorer.restore).to be_truthy + end.to change { SnippetRepository.count }.by(1) blob = snippet.repository.blob_at('HEAD', snippet.file_name) expect(blob).not_to be_nil expect(blob.data).to eq(snippet.content) end end + + context 'when the repository creation fails' do + it 'returns false' do + allow_any_instance_of(Gitlab::BackgroundMigration::BackfillSnippetRepositories).to receive(:perform_by_ids).and_return(nil) + + expect(restorer.restore).to be false + expect(shared.errors.first).to match(/Error creating repository for snippet/) + end + end end context 'when the snippet does not have a bundle file path' do |