summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-03-19 10:07:05 -0700
committerStan Hu <stanhu@gmail.com>2019-03-19 11:23:00 -0700
commit1e6ea914a1affef8490ca15338c885c11d54e17f (patch)
treeb362eef7241b3a19858bb814a2c1fc89d42efb3a /spec
parent934253c9475a2f2d8a562bcc6bbb8a5f52efa713 (diff)
downloadgitlab-ce-1e6ea914a1affef8490ca15338c885c11d54e17f.tar.gz
GitHub import: Create new branches as project owner
This avoids permission errors when importing merge requests whose authors don't have direct access to push to the main repository.
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/github_import/importer/pull_request_importer_spec.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/lib/gitlab/github_import/importer/pull_request_importer_spec.rb b/spec/lib/gitlab/github_import/importer/pull_request_importer_spec.rb
index 15e59718dce..37c3fae7cb7 100644
--- a/spec/lib/gitlab/github_import/importer/pull_request_importer_spec.rb
+++ b/spec/lib/gitlab/github_import/importer/pull_request_importer_spec.rb
@@ -273,6 +273,11 @@ describe Gitlab::GithubImport::Importer::PullRequestImporter, :clean_gitlab_redi
mr.state = 'opened'
mr.save
+ # Ensure the project owner is creating the branches because the
+ # merge request author may not have access to push to this
+ # repository.
+ allow(project.repository).to receive(:add_branch).with(project.owner, anything, anything).and_call_original
+
importer.insert_git_data(mr, exists)
expect(project.repository.branch_exists?(mr.source_branch)).to be_truthy