diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-29 21:08:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-29 21:08:47 +0300 |
commit | 6b9d3a4e8351e662c4586b24bb152de78ae9e3bf (patch) | |
tree | 883e9db60c047c54418fc1d2b1c5517f97e0f185 /spec/services/projects/transfer_service_spec.rb | |
parent | 23288f62da73fb0e30d8e7ce306665e8fda1b932 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/projects/transfer_service_spec.rb')
-rw-r--r-- | spec/services/projects/transfer_service_spec.rb | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/spec/services/projects/transfer_service_spec.rb b/spec/services/projects/transfer_service_spec.rb index 298867f483b..fe31dafdd03 100644 --- a/spec/services/projects/transfer_service_spec.rb +++ b/spec/services/projects/transfer_service_spec.rb @@ -47,11 +47,12 @@ describe Projects::TransferService do end end - it 'disk path has moved' do + it 'moves the disk path', :aggregate_failures do old_path = project.repository.disk_path old_full_path = project.repository.full_path transfer_project(project, user, group) + project.reload_repository! expect(project.repository.disk_path).not_to eq(old_path) expect(project.repository.full_path).not_to eq(old_full_path) @@ -298,22 +299,41 @@ describe Projects::TransferService do end context 'when hashed storage in use' do - let(:hashed_project) { create(:project, :repository, namespace: user.namespace) } + let!(:hashed_project) { create(:project, :repository, namespace: user.namespace) } + let!(:old_disk_path) { hashed_project.repository.disk_path } before do group.add_owner(user) end - it 'does not move the directory' do - old_path = hashed_project.repository.disk_path - old_full_path = hashed_project.repository.full_path + it 'does not move the disk path', :aggregate_failures do + new_full_path = "#{group.full_path}/#{hashed_project.path}" transfer_project(hashed_project, user, group) - project.reload + hashed_project.reload_repository! - expect(hashed_project.repository.disk_path).to eq(old_path) - expect(hashed_project.repository.full_path).to eq(old_full_path) - expect(hashed_project.disk_path).to eq(old_path) + expect(hashed_project.repository).to have_attributes( + disk_path: old_disk_path, + full_path: new_full_path + ) + expect(hashed_project.disk_path).to eq(old_disk_path) + end + + it 'does not move the disk path when the transfer fails', :aggregate_failures do + old_full_path = hashed_project.full_path + + expect_next_instance_of(described_class) do |service| + allow(service).to receive(:execute_system_hooks).and_raise('foo') + end + expect { transfer_project(hashed_project, user, group) }.to raise_error('foo') + + hashed_project.reload_repository! + + expect(hashed_project.repository).to have_attributes( + disk_path: old_disk_path, + full_path: old_full_path + ) + expect(hashed_project.disk_path).to eq(old_disk_path) end end |