diff options
author | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-12-19 12:57:12 +0300 |
---|---|---|
committer | Bob Van Landuyt <bob@vanlanduyt.co> | 2017-12-19 19:06:18 +0300 |
commit | ac862490392b029ac4937188e02bdf09f4505869 (patch) | |
tree | 87863bcffe6f69d4adc72c40ac87315d2e7cdb6a /spec | |
parent | 7ed3759ebb196dc7466b63cabbe12ed43ee7b286 (diff) |
Don't link LFS-objects multiple times.
If Unlinking a fork would fail somewhere after this, the LFS objects
might still be linked. Which would cause issues when trying to destroy
a project.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/projects/unlink_fork_service_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/services/projects/unlink_fork_service_spec.rb b/spec/services/projects/unlink_fork_service_spec.rb index 2bba71fef4f..3ec6139bfa6 100644 --- a/spec/services/projects/unlink_fork_service_spec.rb +++ b/spec/services/projects/unlink_fork_service_spec.rb @@ -62,6 +62,26 @@ describe Projects::UnlinkForkService do expect(source.forks_count).to be_zero end + context 'when the source has LFS objects' do + let(:lfs_object) { create(:lfs_object) } + + before do + lfs_object.projects << project + end + + it 'links the fork to the lfs object before unlinking' do + subject.execute + + expect(lfs_object.projects).to include(forked_project) + end + + it 'does not fail if the lfs objects were already linked' do + lfs_object.projects << forked_project + + expect { subject.execute }.not_to raise_error + end + end + context 'when the original project was deleted' do it 'does not fail when the original project is deleted' do source = forked_project.forked_from_project |