diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-17 12:09:26 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-17 12:09:26 +0000 |
commit | 75a4eaade04ee758bb3b253f27bf1c20c67991f0 (patch) | |
tree | 779b3011793bf35770774dbaa51eec55efd320cd /spec/models/packages | |
parent | 839e879bcf197a283da8481ddcb15b177172784d (diff) | |
download | gitlab-ce-75a4eaade04ee758bb3b253f27bf1c20c67991f0.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/packages')
-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 cdf03b3c958..6c55d37b95f 100644 --- a/spec/models/packages/package_spec.rb +++ b/spec/models/packages/package_spec.rb @@ -4,6 +4,8 @@ require 'spec_helper' RSpec.describe Packages::Package, type: :model do include SortingHelper + it_behaves_like 'having unique enum values' + describe 'relationships' do it { is_expected.to belong_to(:project) } it { is_expected.to belong_to(:creator) } @@ -605,6 +607,28 @@ RSpec.describe Packages::Package, type: :model do it { is_expected.to match_array([pypi_package]) } end + + describe '.displayable' do + let_it_be(:hidden_package) { create(:maven_package, :hidden) } + let_it_be(:processing_package) { create(:maven_package, :processing) } + + subject { described_class.displayable } + + it 'does not include hidden packages', :aggregate_failures do + is_expected.not_to include(hidden_package) + is_expected.not_to include(processing_package) + end + end + + describe '.with_status' do + let_it_be(:hidden_package) { create(:maven_package, :hidden) } + + subject { described_class.with_status(:hidden) } + + it 'returns packages with specified status' do + is_expected.to match_array([hidden_package]) + end + end end describe '.select_distinct_name' do |