diff options
Diffstat (limited to 'spec/models/packages')
-rw-r--r-- | spec/models/packages/package_file_spec.rb | 7 | ||||
-rw-r--r-- | spec/models/packages/package_spec.rb | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/spec/models/packages/package_file_spec.rb b/spec/models/packages/package_file_spec.rb index a244ed34e54..9b341034aaa 100644 --- a/spec/models/packages/package_file_spec.rb +++ b/spec/models/packages/package_file_spec.rb @@ -8,6 +8,7 @@ RSpec.describe Packages::PackageFile, type: :model do let_it_be(:package_file1) { create(:package_file, :xml, file_name: 'FooBar') } let_it_be(:package_file2) { create(:package_file, :xml, file_name: 'ThisIsATest') } let_it_be(:package_file3) { create(:package_file, :xml, file_name: 'formatted.zip') } + let_it_be(:package_file4) { create(:package_file, :nuget) } let_it_be(:debian_package) { create(:debian_package, project: project) } it_behaves_like 'having unique enum values' @@ -98,6 +99,12 @@ RSpec.describe Packages::PackageFile, type: :model do it { is_expected.to contain_exactly(package_file3) } end + + describe '.with_nuget_format' do + subject { described_class.with_nuget_format } + + it { is_expected.to contain_exactly(package_file4) } + end end context 'updating project statistics' do diff --git a/spec/models/packages/package_spec.rb b/spec/models/packages/package_spec.rb index d6f71f2401c..a8bcda1242f 100644 --- a/spec/models/packages/package_spec.rb +++ b/spec/models/packages/package_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'spec_helper' -RSpec.describe Packages::Package, type: :model do +RSpec.describe Packages::Package, type: :model, feature_category: :package_registry do include SortingHelper using RSpec::Parameterized::TableSyntax @@ -14,6 +14,7 @@ RSpec.describe Packages::Package, type: :model do it { is_expected.to have_many(:dependency_links).inverse_of(:package) } it { is_expected.to have_many(:tags).inverse_of(:package) } it { is_expected.to have_many(:build_infos).inverse_of(:package) } + it { is_expected.to have_many(:installable_nuget_package_files).inverse_of(:package) } it { is_expected.to have_one(:conan_metadatum).inverse_of(:package) } it { is_expected.to have_one(:maven_metadatum).inverse_of(:package) } it { is_expected.to have_one(:debian_publication).inverse_of(:package).class_name('Packages::Debian::Publication') } @@ -713,7 +714,7 @@ RSpec.describe Packages::Package, type: :model do subject(:destroy!) { package.destroy! } it 'updates the project statistics' do - expect(project_statistics).to receive(:increment_counter).with(:packages_size, -package_file.size) + expect(project_statistics).to receive(:increment_counter).with(:packages_size, have_attributes(amount: -package_file.size)) destroy! end |