diff options
author | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 22:34:23 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 22:34:23 +0300 |
commit | 6438df3a1e0fb944485cebf07976160184697d72 (patch) | |
tree | 00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /spec/models/group_spec.rb | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'spec/models/group_spec.rb')
-rw-r--r-- | spec/models/group_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/models/group_spec.rb b/spec/models/group_spec.rb index cc8e744a15c..0acf2b96b74 100644 --- a/spec/models/group_spec.rb +++ b/spec/models/group_spec.rb @@ -31,6 +31,7 @@ RSpec.describe Group do it { is_expected.to have_one(:dependency_proxy_setting) } it { is_expected.to have_many(:dependency_proxy_blobs) } it { is_expected.to have_many(:dependency_proxy_manifests) } + it { is_expected.to have_many(:debian_distributions).class_name('Packages::Debian::GroupDistribution').dependent(:destroy) } describe '#members & #requesters' do let(:requester) { create(:user) } @@ -1751,4 +1752,23 @@ RSpec.describe Group do it { is_expected.to eq(false) } end end + + describe 'with Debian Distributions' do + subject { create(:group) } + + let!(:distributions) { create_list(:debian_group_distribution, 2, :with_file, container: subject) } + + it 'removes distribution files on removal' do + distribution_file_paths = distributions.map do |distribution| + distribution.file.path + end + + expect { subject.destroy } + .to change { + distribution_file_paths.select do |path| + File.exist? path + end.length + }.from(distribution_file_paths.length).to(0) + end + end end |