Commit 14949ba6 authored by James Lopez's avatar James Lopez

fix path bug and update specs

parent 151361f4
...@@ -43,7 +43,7 @@ module Projects ...@@ -43,7 +43,7 @@ module Projects
@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 @@ describe Projects::TransferService do ...@@ -172,8 +172,9 @@ describe Projects::TransferService do
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 @@ describe Projects::TransferService do ...@@ -187,7 +188,7 @@ describe Projects::TransferService do
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