summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2017-06-07 14:57:26 +0200
committerJames Lopez <james@jameslopez.es>2017-06-07 14:57:26 +0200
commit1b76c7196b3b50074e6f2eba64d988ead90e7264 (patch)
treebda1ff42f15655b32fd8282cd7fe439e00662802
parent6e92d902e6df21dcfba2b2b592137825822d9d88 (diff)
downloadgitlab-ce-1b76c7196b3b50074e6f2eba64d988ead90e7264.tar.gz
add more spec examples
-rw-r--r--spec/lib/gitlab/backup/repository_spec.rb47
1 files changed, 41 insertions, 6 deletions
diff --git a/spec/lib/gitlab/backup/repository_spec.rb b/spec/lib/gitlab/backup/repository_spec.rb
index 3d4bc39e17c..5399b4ac805 100644
--- a/spec/lib/gitlab/backup/repository_spec.rb
+++ b/spec/lib/gitlab/backup/repository_spec.rb
@@ -22,14 +22,49 @@ describe Backup::Repository, lib: true do
$progress = @old_progress # rubocop:disable Style/GlobalVars
end
- describe 'repo failure' do
- before do
- allow_any_instance_of(Project).to receive(:empty_repo?).and_raise(Rugged::OdbError)
- allow(Gitlab::Popen).to receive(:popen).and_return(['normal output', 0])
+ describe '.dump' do
+ describe 'repo failure' do
+ before do
+ allow_any_instance_of(Project).to receive(:empty_repo?).and_raise(Rugged::OdbError)
+ allow(Gitlab::Popen).to receive(:popen).and_return(['normal output', 0])
+ end
+
+ it 'does not raise error' do
+ expect { described_class.new.dump }.not_to raise_error
+ end
+
+ it 'shows the appropriate error' do
+ described_class.new.dump
+
+ expect(progress).to have_received(:puts).with("Ignoring error on #{project.full_path} repository - Rugged::OdbError")
+ end
+ end
+
+ describe 'command failure' do
+ before do
+ allow_any_instance_of(Project).to receive(:empty_repo?).and_return(false)
+ allow(Gitlab::Popen).to receive(:popen).and_return(['error', 1])
+ end
+
+ it 'shows the appropriate error' do
+ described_class.new.dump
+
+ expect(progress).to have_received(:puts).with("Ignoring error on #{project.full_path} - error")
+ end
end
+ end
+
+ describe '.restore' do
+ describe 'command failure' do
+ before do
+ allow(Gitlab::Popen).to receive(:popen).and_return(['error', 1])
+ end
+
+ it 'shows the appropriate error' do
+ described_class.new.restore
- it 'does not raise error' do
- expect { described_class.new.dump }.not_to raise_error
+ expect(progress).to have_received(:puts).with("Ignoring error on #{project.full_path} - error")
+ end
end
end
end