diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /spec/lib/gitlab/import_export/snippet_repo_restorer_spec.rb | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
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 |