summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2017-06-07 16:50:21 +0200
committerJames Lopez <james@jameslopez.es>2017-06-07 16:50:21 +0200
commit8acb0f55961500658377a1f941584dddb7952570 (patch)
treef06a6f8ebd9564cfaf2f2ad42bae2ad1c5c9d0d5 /spec
parente2eb0b6f77e66fee1bb50e86ebbc013e1afb784e (diff)
downloadgitlab-ce-8acb0f55961500658377a1f941584dddb7952570.tar.gz
refactor code and spec
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/backup/repository_spec.rb13
1 files changed, 4 insertions, 9 deletions
diff --git a/spec/lib/gitlab/backup/repository_spec.rb b/spec/lib/gitlab/backup/repository_spec.rb
index 7d0d537f2f2..51c1e9d657b 100644
--- a/spec/lib/gitlab/backup/repository_spec.rb
+++ b/spec/lib/gitlab/backup/repository_spec.rb
@@ -12,18 +12,13 @@ describe Backup::Repository, lib: true do
string
end
- @old_progress = $progress # rubocop:disable Style/GlobalVars
- $progress = progress # rubocop:disable Style/GlobalVars
- end
-
- after do
- $progress = @old_progress # rubocop:disable Style/GlobalVars
+ allow_any_instance_of(described_class).to receive(:progress).and_return(progress)
end
describe '#dump' do
describe 'repo failure' do
before do
- allow_any_instance_of(Project).to receive(:empty_repo?).and_raise(Rugged::OdbError)
+ allow_any_instance_of(Repository).to receive(:empty_repo?).and_raise(Rugged::OdbError)
allow(Gitlab::Popen).to receive(:popen).and_return(['normal output', 0])
end
@@ -34,13 +29,13 @@ describe Backup::Repository, lib: true do
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")
+ expect(progress).to have_received(:puts).with("Ignoring repository error and continuing backing up project: #{project.full_path} - Rugged::OdbError")
end
end
describe 'command failure' do
before do
- allow_any_instance_of(Project).to receive(:empty_repo?).and_return(false)
+ allow_any_instance_of(Repository).to receive(:empty_repo?).and_return(false)
allow(Gitlab::Popen).to receive(:popen).and_return(['error', 1])
end