Commit 7f985825 authored by James Lopez's avatar James Lopez
Browse files

fix path bug and update specs

parent 46b9ec80e0d9
...@@ -43,7 +43,7 @@ def transfer(project) ...@@ -43,7 +43,7 @@ def transfer(project)
@new_path = File.join(@new_namespace.try(:full_path) || '', project.path) @new_path = File.join(@new_namespace.try(:full_path) || '', project.path)
@old_namespace = project.namespace @old_namespace = project.namespace
if Project.where(namespace_id: @new_namespace.try(:id)).where('path = ? or name = ?', project.path, project.path).exists? if Project.where(namespace_id: @new_namespace.try(:id)).where('path = ? or name = ?', project.path, project.name).exists?
raise TransferError.new("Project with same name or path in target namespace already exists") raise TransferError.new("Project with same name or path in target namespace already exists")
end end
......
...@@ -172,8 +172,9 @@ def current_path ...@@ -172,8 +172,9 @@ def current_path
context 'target namespace containing the same project name' do context 'target namespace containing the same project name' do
before do before do
group.add_owner(user) group.add_owner(user)
project.update(name: 'new_name')
create(:project, name: project.name, group: group, path: 'other') create(:project, name: 'new_name', group: group, path: 'other')
@result = transfer_project(project, user, group) @result = transfer_project(project, user, group)
end end
...@@ -187,7 +188,7 @@ def current_path ...@@ -187,7 +188,7 @@ def current_path
before do before do
group.add_owner(user) group.add_owner(user)
create(:project, name: project.name, group: group) create(:project, name: 'other-name', path: project.path, group: group)
@result = transfer_project(project, user, group) @result = transfer_project(project, user, group)
end end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment