diff options
Diffstat (limited to 'spec/services/groups/transfer_service_spec.rb')
-rw-r--r-- | spec/services/groups/transfer_service_spec.rb | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/spec/services/groups/transfer_service_spec.rb b/spec/services/groups/transfer_service_spec.rb index b32953982c0..bd207777783 100644 --- a/spec/services/groups/transfer_service_spec.rb +++ b/spec/services/groups/transfer_service_spec.rb @@ -70,10 +70,10 @@ describe Groups::TransferService, :postgresql do end context 'when there is a group with the same path' do - let!(:group) { create(:group, :public, :nested, path: "not-unique") } + let!(:group) { create(:group, :public, :nested, path: 'not-unique') } before do - create(:group, path: "not-unique") + create(:group, path: 'not-unique') end it 'should return false' do @@ -82,7 +82,7 @@ describe Groups::TransferService, :postgresql do it 'should add an error on group' do transfer_service.execute(nil) - expect(transfer_service.error).to eq('Transfer failed: The parent group has a group with the same path.') + expect(transfer_service.error).to eq('Transfer failed: The parent group has a namespace with the same path.') end end @@ -158,7 +158,26 @@ describe Groups::TransferService, :postgresql do it 'should add an error on group' do transfer_service.execute(new_parent_group) - expect(transfer_service.error).to eq('Transfer failed: The parent group has a group with the same path.') + expect(transfer_service.error).to eq('Transfer failed: The parent group has a namespace with the same path.') + end + end + + context 'when the parent group has a project with the same path' do + let!(:group) { create(:group, :public, :nested, path: 'foo') } + + before do + create(:group_member, :owner, group: new_parent_group, user: user) + create(:project, path: 'foo', namespace: new_parent_group) + group.update_attribute(:path, 'foo') + end + + it 'should return false' do + expect(transfer_service.execute(new_parent_group)).to be_falsy + end + + it 'should add an error on group' do + transfer_service.execute(new_parent_group) + expect(transfer_service.error).to eq('Transfer failed: Validation failed: Route path has already been taken, Route is invalid') end end |