diff options
author | James Lopez <james@jameslopez.es> | 2018-08-29 11:14:37 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2018-08-29 11:14:37 +0300 |
commit | d5632b6b91cbe3936c9ac6886b91adb24ce4013f (patch) | |
tree | 5cade2eec3b813418e815ca6ec02b18db53bb707 /spec/services/projects/transfer_service_spec.rb | |
parent | 04845fdeae75ba5de7c93992a5d55663edf647e0 (diff) |
add specs replicating transfer issue
Diffstat (limited to 'spec/services/projects/transfer_service_spec.rb')
-rw-r--r-- | spec/services/projects/transfer_service_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/services/projects/transfer_service_spec.rb b/spec/services/projects/transfer_service_spec.rb index 1a85c52fc97..d49cca65a2b 100644 --- a/spec/services/projects/transfer_service_spec.rb +++ b/spec/services/projects/transfer_service_spec.rb @@ -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) |