Commit 942bec63 authored by Gabriel Mazetto's avatar Gabriel Mazetto

Specs for NoRepository rescue behavior

parent 0a9ea81c
......@@ -205,5 +205,26 @@ describe Geo::RepositorySyncService, services: true do
end
end
end
context 'when Gitlab::Shell::Error is raised' do
let(:project) { create(:project_empty_repo) }
it 'rescues exception' do
allow(subject).to receive(:fetch_project_repository).and_raise(Gitlab::Shell::Error)
expect { subject.execute }.not_to raise_error
end
end
context 'when Gitlab::Git::Repository::NoRepository is raised' do
let(:project) { create(:project_empty_repo) }
it 'rescues exception and fires after_create hook' do
allow(subject).to receive(:fetch_project_repository).and_raise(Gitlab::Git::Repository::NoRepository)
expect_any_instance_of(Repository).to receive(:after_create)
expect { subject.execute }.not_to raise_error
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment