summaryrefslogtreecommitdiff
path: root/spec/lib/backup/repository_backup_error_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 09:08:42 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 09:08:42 +0000
commitb76ae638462ab0f673e5915986070518dd3f9ad3 (patch)
treebdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/lib/backup/repository_backup_error_spec.rb
parent434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff)
downloadgitlab-ce-b76ae638462ab0f673e5915986070518dd3f9ad3.tar.gz
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/lib/backup/repository_backup_error_spec.rb')
-rw-r--r--spec/lib/backup/repository_backup_error_spec.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/lib/backup/repository_backup_error_spec.rb b/spec/lib/backup/repository_backup_error_spec.rb
new file mode 100644
index 00000000000..44c75c1cf77
--- /dev/null
+++ b/spec/lib/backup/repository_backup_error_spec.rb
@@ -0,0 +1,42 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Backup::RepositoryBackupError do
+ let_it_be(:snippet) { create(:snippet, content: 'foo', file_name: 'foo') }
+ let_it_be(:project) { create(:project, :repository) }
+ let_it_be(:wiki) { ProjectWiki.new(project, nil ) }
+
+ let(:backup_repos_path) { '/tmp/backup/repositories' }
+
+ shared_examples 'includes backup path' do
+ it { is_expected.to respond_to :container }
+ it { is_expected.to respond_to :backup_repos_path }
+
+ it 'expects exception message to include repo backup path location' do
+ expect(subject.message).to include("#{subject.backup_repos_path}")
+ end
+
+ it 'expects exception message to include container being back-up' do
+ expect(subject.message).to include("#{subject.container.disk_path}")
+ end
+ end
+
+ context 'with snippet repository' do
+ subject { described_class.new(snippet, backup_repos_path) }
+
+ it_behaves_like 'includes backup path'
+ end
+
+ context 'with project repository' do
+ subject { described_class.new(project, backup_repos_path) }
+
+ it_behaves_like 'includes backup path'
+ end
+
+ context 'with wiki repository' do
+ subject { described_class.new(wiki, backup_repos_path) }
+
+ it_behaves_like 'includes backup path'
+ end
+end