add more spec examples
This commit is contained in:
parent
6e92d902e6
commit
1b76c7196b
1 changed files with 41 additions and 6 deletions
|
@ -22,6 +22,7 @@ describe Backup::Repository, lib: true do
|
||||||
$progress = @old_progress # rubocop:disable Style/GlobalVars
|
$progress = @old_progress # rubocop:disable Style/GlobalVars
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '.dump' do
|
||||||
describe 'repo failure' do
|
describe 'repo failure' do
|
||||||
before do
|
before do
|
||||||
allow_any_instance_of(Project).to receive(:empty_repo?).and_raise(Rugged::OdbError)
|
allow_any_instance_of(Project).to receive(:empty_repo?).and_raise(Rugged::OdbError)
|
||||||
|
@ -31,5 +32,39 @@ describe Backup::Repository, lib: true do
|
||||||
it 'does not raise error' do
|
it 'does not raise error' do
|
||||||
expect { described_class.new.dump }.not_to raise_error
|
expect { described_class.new.dump }.not_to raise_error
|
||||||
end
|
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
|
||||||
|
|
||||||
|
expect(progress).to have_received(:puts).with("Ignoring error on #{project.full_path} - error")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue