summaryrefslogtreecommitdiff
path: root/spec/controllers/import/gitlab_controller_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/import/gitlab_controller_spec.rb')
-rw-r--r--spec/controllers/import/gitlab_controller_spec.rb21
1 files changed, 9 insertions, 12 deletions
diff --git a/spec/controllers/import/gitlab_controller_spec.rb b/spec/controllers/import/gitlab_controller_spec.rb
index 3afd09063d7..3270ea059fa 100644
--- a/spec/controllers/import/gitlab_controller_spec.rb
+++ b/spec/controllers/import/gitlab_controller_spec.rb
@@ -108,13 +108,9 @@ describe Import::GitlabController do
end
context "when a namespace with the GitLab.com user's username already exists" do
- let!(:existing_namespace) { create(:group, name: other_username) }
+ let!(:existing_namespace) { create(:namespace, name: other_username, owner: user) }
context "when the namespace is owned by the GitLab server user" do
- before do
- existing_namespace.add_owner(user)
- end
-
it "takes the existing namespace" do
expect(Gitlab::GitlabImport::ProjectCreator).
to receive(:new).with(gitlab_repo, existing_namespace, user, access_params).
@@ -125,6 +121,11 @@ describe Import::GitlabController do
end
context "when the namespace is not owned by the GitLab server user" do
+ before do
+ existing_namespace.owner = create(:user)
+ existing_namespace.save
+ end
+
it "doesn't create a project" do
expect(Gitlab::GitlabImport::ProjectCreator).
not_to receive(:new)
@@ -175,12 +176,8 @@ describe Import::GitlabController do
end
context 'user has chosen an existing nested namespace for the project' do
- let(:parent_namespace) { create(:group, name: 'foo', owner: user) }
- let(:nested_namespace) { create(:group, name: 'bar', parent: parent_namespace) }
-
- before do
- nested_namespace.add_owner(user)
- end
+ let(:parent_namespace) { create(:namespace, name: 'foo', owner: user) }
+ let(:nested_namespace) { create(:namespace, name: 'bar', parent: parent_namespace, owner: user) }
it 'takes the selected namespace and name' do
expect(Gitlab::GitlabImport::ProjectCreator).
@@ -224,7 +221,7 @@ describe Import::GitlabController do
context 'user has chosen existent and non-existent nested namespaces and name for the project' do
let(:test_name) { 'test_name' }
- let!(:parent_namespace) { create(:group, name: 'foo', owner: user) }
+ let!(:parent_namespace) { create(:namespace, name: 'foo', owner: user) }
it 'takes the selected namespace and name' do
expect(Gitlab::GitlabImport::ProjectCreator).