Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/packages/package_file_spec.rb')
-rw-r--r--spec/models/packages/package_file_spec.rb23
1 files changed, 22 insertions, 1 deletions
diff --git a/spec/models/packages/package_file_spec.rb b/spec/models/packages/package_file_spec.rb
index 450656e3e9c..8617793f41d 100644
--- a/spec/models/packages/package_file_spec.rb
+++ b/spec/models/packages/package_file_spec.rb
@@ -14,7 +14,6 @@ RSpec.describe Packages::PackageFile, type: :model do
it { is_expected.to belong_to(:package) }
it { is_expected.to have_one(:conan_file_metadatum) }
it { is_expected.to have_many(:package_file_build_infos).inverse_of(:package_file) }
- it { is_expected.to have_many(:pipelines).through(:package_file_build_infos) }
it { is_expected.to have_one(:debian_file_metadatum).inverse_of(:package_file).class_name('Packages::Debian::FileMetadatum') }
it { is_expected.to have_one(:helm_file_metadatum).inverse_of(:package_file).class_name('Packages::Helm::FileMetadatum') }
end
@@ -206,6 +205,28 @@ RSpec.describe Packages::PackageFile, type: :model do
end
end
+ describe '#pipelines' do
+ let_it_be_with_refind(:package_file) { create(:package_file) }
+
+ subject { package_file.pipelines }
+
+ context 'package_file without pipeline' do
+ it { is_expected.to be_empty }
+ end
+
+ context 'package_file with pipeline' do
+ let_it_be(:pipeline) { create(:ci_pipeline) }
+ let_it_be(:pipeline2) { create(:ci_pipeline) }
+
+ before do
+ package_file.package_file_build_infos.create!(pipeline: pipeline)
+ package_file.package_file_build_infos.create!(pipeline: pipeline2)
+ end
+
+ it { is_expected.to contain_exactly(pipeline, pipeline2) }
+ end
+ end
+
describe '#update_file_store callback' do
let_it_be(:package_file) { build(:package_file, :nuget, size: nil) }