diff options
author | James Lopez <james@jameslopez.es> | 2017-06-07 10:38:12 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2017-06-07 10:38:12 +0200 |
commit | 6e92d902e6df21dcfba2b2b592137825822d9d88 (patch) | |
tree | bc77436ae064f57282803e3be0f00bac3f84113d | |
parent | 1d749356c30bc18be5805dac7bc49565782ec30d (diff) | |
download | gitlab-ce-6e92d902e6df21dcfba2b2b592137825822d9d88.tar.gz |
add repository spec
-rw-r--r-- | spec/lib/gitlab/backup/repository_spec.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/lib/gitlab/backup/repository_spec.rb b/spec/lib/gitlab/backup/repository_spec.rb new file mode 100644 index 00000000000..3d4bc39e17c --- /dev/null +++ b/spec/lib/gitlab/backup/repository_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' + +describe Backup::Repository, lib: true do + include StubENV + + let(:progress) { StringIO.new } + let!(:project) { create(:empty_project) } + + before do + allow(progress).to receive(:puts) + allow(progress).to receive(:print) + + allow_any_instance_of(String).to receive(:color) do |string, _color| + 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 + 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]) + end + + it 'does not raise error' do + expect { described_class.new.dump }.not_to raise_error + end + end +end |