diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-18 00:09:16 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-18 00:09:16 +0300 |
commit | 154b9bae142ba15fec753f44327654595094b879 (patch) | |
tree | 027f8ae024961778d5b00c77a72fe302f985d4f3 /spec/lib/gitlab/git/repository_spec.rb | |
parent | 2c156e3c7bbade01c36eee18327f1ced6eebea79 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/git/repository_spec.rb')
-rw-r--r-- | spec/lib/gitlab/git/repository_spec.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index a2326728679..b706cad612a 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -2138,6 +2138,33 @@ describe Gitlab::Git::Repository, :seed_helper do end end + describe '#import_repository' do + let_it_be(:project) { create(:project) } + + let(:repository) { project.repository } + let(:url) { 'http://invalid.invalid' } + + it 'raises an error if a relative path is provided' do + expect { repository.import_repository('/foo') }.to raise_error(ArgumentError, /disk path/) + end + + it 'raises an error if an absolute path is provided' do + expect { repository.import_repository('./foo') }.to raise_error(ArgumentError, /disk path/) + end + + it 'delegates to Gitaly' do + expect_next_instance_of(Gitlab::GitalyClient::RepositoryService) do |svc| + expect(svc).to receive(:import_repository).with(url).and_return(nil) + end + + repository.import_repository(url) + end + + it_behaves_like 'wrapping gRPC errors', Gitlab::GitalyClient::RepositoryService, :import_repository do + subject { repository.import_repository('http://invalid.invalid') } + end + end + describe '#replicate' do let(:new_repository) do Gitlab::Git::Repository.new('test_second_storage', TEST_REPO_PATH, '', 'group/project') |