diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-26 18:10:52 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-26 18:10:52 +0000 |
commit | 4c47bc5ec6420ab3a4ef629010e89de45b2776b9 (patch) | |
tree | 941f43a86f23dc601a0778571a36f53dfb4c44c6 /spec/models/lfs_object_spec.rb | |
parent | ede9464fd957582e4e0232f70113942b08ddfe78 (diff) | |
download | gitlab-ce-4c47bc5ec6420ab3a4ef629010e89de45b2776b9.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/lfs_object_spec.rb')
-rw-r--r-- | spec/models/lfs_object_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/models/lfs_object_spec.rb b/spec/models/lfs_object_spec.rb index a0f633218b0..0c019cb8bc6 100644 --- a/spec/models/lfs_object_spec.rb +++ b/spec/models/lfs_object_spec.rb @@ -178,4 +178,17 @@ RSpec.describe LfsObject do expect(described_class.calculate_oid(path)).to eq expected end end + + context 'when an lfs object is associated with a project' do + let!(:lfs_object) { create(:lfs_object) } + let!(:lfs_object_project) { create(:lfs_objects_project, lfs_object: lfs_object) } + + it 'cannot be deleted' do + expect { lfs_object.destroy! }.to raise_error(ActiveRecord::InvalidForeignKey) + + lfs_object_project.destroy! + + expect { lfs_object.destroy! }.not_to raise_error + end + end end |