diff options
author | Robert Speicher <rspeicher@gmail.com> | 2019-01-24 02:49:42 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2019-01-24 02:49:42 +0300 |
commit | de3af288ce4e478acf8ad7a89690e7215a2bf6a0 (patch) | |
tree | 6bf3fca388dbcfa404401a97ea28622051717692 /spec | |
parent | 3effc289ca2765a45867525ba34491008ff6cf04 (diff) | |
parent | 100b050b996072cc302a3a7f8fac850ddaab27d4 (diff) |
Merge branch 'sh-remove-bitbucket-mirror-constant' into 'master'
Fix import handling errors in Bitbucket Server importer
See merge request gitlab-org/gitlab-ce!24499
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/bitbucket_server_import/importer_spec.rb | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/spec/lib/gitlab/bitbucket_server_import/importer_spec.rb b/spec/lib/gitlab/bitbucket_server_import/importer_spec.rb index 70423823b89..1e90a2ef27f 100644 --- a/spec/lib/gitlab/bitbucket_server_import/importer_spec.rb +++ b/spec/lib/gitlab/bitbucket_server_import/importer_spec.rb @@ -21,12 +21,9 @@ describe Gitlab::BitbucketServerImport::Importer do end describe '#import_repository' do - before do + it 'adds a remote' do expect(subject).to receive(:import_pull_requests) expect(subject).to receive(:delete_temp_branches) - end - - it 'adds a remote' do expect(project.repository).to receive(:fetch_as_mirror) .with('http://bitbucket:test@my-bitbucket', refmap: [:heads, :tags, '+refs/pull-requests/*/to:refs/merge-requests/*/head'], @@ -34,6 +31,18 @@ describe Gitlab::BitbucketServerImport::Importer do subject.execute end + + it 'raises a Gitlab::Shell exception in the fetch' do + expect(project.repository).to receive(:fetch_as_mirror).and_raise(Gitlab::Shell::Error) + + expect { subject.execute }.to raise_error(Gitlab::Shell::Error) + end + + it 'raises an unhandled exception in the fetch' do + expect(project.repository).to receive(:fetch_as_mirror).and_raise(RuntimeError) + + expect { subject.execute }.to raise_error(RuntimeError) + end end describe '#import_pull_requests' do |