summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2019-01-23 23:49:42 +0000
committerRobert Speicher <rspeicher@gmail.com>2019-01-23 23:49:42 +0000
commitde3af288ce4e478acf8ad7a89690e7215a2bf6a0 (patch)
tree6bf3fca388dbcfa404401a97ea28622051717692 /spec
parent3effc289ca2765a45867525ba34491008ff6cf04 (diff)
parent100b050b996072cc302a3a7f8fac850ddaab27d4 (diff)
downloadgitlab-ce-de3af288ce4e478acf8ad7a89690e7215a2bf6a0.tar.gz
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.rb17
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