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/packages/package_spec.rb | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'spec/models/packages/package_spec.rb')
-rw-r--r-- | spec/models/packages/package_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/packages/package_spec.rb b/spec/models/packages/package_spec.rb index 16764673474..6645db33503 100644 --- a/spec/models/packages/package_spec.rb +++ b/spec/models/packages/package_spec.rb @@ -599,6 +599,20 @@ RSpec.describe Packages::Package, type: :model do end end + describe '.order_by_package_file' do + let_it_be(:project) { create(:project) } + let_it_be(:package1) { create(:maven_package, project: project) } + let_it_be(:package2) { create(:maven_package, project: project) } + + it 'orders packages their associated package_file\'s created_at date', :aggregate_failures do + expect(project.packages.order_by_package_file).to match_array([package1, package1, package1, package2, package2, package2]) + + create(:package_file, :xml, package: package1) + + expect(project.packages.order_by_package_file).to match_array([package1, package1, package1, package2, package2, package2, package1]) + end + end + describe '#versions' do let_it_be(:project) { create(:project) } let_it_be(:package) { create(:maven_package, project: project) } @@ -731,4 +745,14 @@ RSpec.describe Packages::Package, type: :model do end end end + + describe '#package_settings' do + let_it_be(:group) { create(:group) } + let_it_be(:project) { create(:project, group: group) } + let_it_be(:package) { create(:maven_package, project: project) } + + it 'returns the namespace package_settings' do + expect(package.package_settings).to eq(group.package_settings) + end + end end |