add specs replicating transfer issue

This commit is contained in:
James Lopez 2018-08-29 10:14:37 +02:00
parent 04845fdeae
commit d5632b6b91
No known key found for this signature in database
GPG key ID: 756BF8E9D7C0CF39

View file

@ -169,6 +169,34 @@ describe Projects::TransferService do
it { expect(project.errors[:new_namespace]).to include('Cannot move project') }
end
context 'target namespace containing the same project name' do
before do
group.add_owner(user)
create(:project, name: project.name, group: group, path: 'other')
@result = transfer_project(project, user, group)
end
it { expect(@result).to eq false }
it { expect(project.namespace).to eq(user.namespace) }
it { expect(project.errors[:new_namespace]).to include('Project with same name or path in target namespace already exists') }
end
context 'target namespace containing the same project path' do
before do
group.add_owner(user)
create(:project, name: project.name, group: group)
@result = transfer_project(project, user, group)
end
it { expect(@result).to eq false }
it { expect(project.namespace).to eq(user.namespace) }
it { expect(project.errors[:new_namespace]).to include('Project with same name or path in target namespace already exists') }
end
def transfer_project(project, user, new_namespace)
service = Projects::TransferService.new(project, user)