Allow users to import GitHub projects to subgroups

This commit is contained in:
Douglas Barbosa Alexandre 2017-03-30 21:24:49 +00:00 committed by Robert Speicher
parent 6ff5e7f798
commit 9bac3bfc58
3 changed files with 19 additions and 1 deletions

View File

@ -11,7 +11,7 @@ class Import::BaseController < ApplicationController
namespace.add_owner(current_user) namespace.add_owner(current_user)
namespace namespace
rescue ActiveRecord::RecordNotUnique, ActiveRecord::RecordInvalid rescue ActiveRecord::RecordNotUnique, ActiveRecord::RecordInvalid
Namespace.find_by_path_or_name(name) Namespace.find_by_full_path(name)
end end
end end
end end

View File

@ -0,0 +1,4 @@
---
title: Allow users to import GitHub projects to subgroups
merge_request:
author:

View File

@ -228,5 +228,19 @@ shared_examples 'a GitHub-ish import controller: POST create' do
post :create, { new_name: test_name, format: :js } post :create, { new_name: test_name, format: :js }
end end
end end
context 'user has chosen a nested namespace and name for the project' do
let(:parent_namespace) { create(:namespace, name: 'foo', owner: user) }
let(:nested_namespace) { create(:namespace, name: 'bar', parent: parent_namespace, owner: user) }
let(:test_name) { 'test_name' }
it 'takes the selected namespace and name' do
expect(Gitlab::GithubImport::ProjectCreator).
to receive(:new).with(provider_repo, test_name, nested_namespace, user, access_params, type: provider).
and_return(double(execute: true))
post :create, { target_namespace: nested_namespace.full_path, new_name: test_name, format: :js }
end
end
end end
end end