diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-07 15:09:00 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-06-07 15:09:00 +0300 |
commit | ba27dbddc7dbc42f2cc8d84e815a9ea19f87a81d (patch) | |
tree | e71fba864897fa78be7f0c40ded23d0f719abf84 /spec/models | |
parent | 708815aefead73a61473c1a611aea169ab16a358 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/concerns/packages/downloadable_spec.rb | 19 | ||||
-rw-r--r-- | spec/models/packages/npm/metadata_cache_spec.rb | 1 | ||||
-rw-r--r-- | spec/models/packages/package_spec.rb | 14 |
3 files changed, 22 insertions, 12 deletions
diff --git a/spec/models/concerns/packages/downloadable_spec.rb b/spec/models/concerns/packages/downloadable_spec.rb new file mode 100644 index 00000000000..79e0d684b7c --- /dev/null +++ b/spec/models/concerns/packages/downloadable_spec.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Packages::Downloadable, feature_category: :package_registry do + context 'with a package' do + describe '#touch_last_downloaded_at' do + let_it_be(:package) { create(:package) } + + subject { package.touch_last_downloaded_at } + + it 'updates the downloaded_at' do + expect(::Gitlab::Database::LoadBalancing::Session).to receive(:without_sticky_writes).and_call_original + expect { subject } + .to change { package.last_downloaded_at }.from(nil).to(instance_of(ActiveSupport::TimeWithZone)) + end + end + end +end diff --git a/spec/models/packages/npm/metadata_cache_spec.rb b/spec/models/packages/npm/metadata_cache_spec.rb index 5e7a710baf8..94b41ab6a5e 100644 --- a/spec/models/packages/npm/metadata_cache_spec.rb +++ b/spec/models/packages/npm/metadata_cache_spec.rb @@ -7,6 +7,7 @@ RSpec.describe Packages::Npm::MetadataCache, type: :model, feature_category: :pa let_it_be(:package_name) { '@root/test' } it { is_expected.to be_a FileStoreMounter } + it { is_expected.to be_a Packages::Downloadable } describe 'relationships' do it { is_expected.to belong_to(:project).inverse_of(:npm_metadata_caches) } diff --git a/spec/models/packages/package_spec.rb b/spec/models/packages/package_spec.rb index 5dd7a0982be..90a5d815427 100644 --- a/spec/models/packages/package_spec.rb +++ b/spec/models/packages/package_spec.rb @@ -7,6 +7,8 @@ RSpec.describe Packages::Package, type: :model, feature_category: :package_regis it_behaves_like 'having unique enum values' + it { is_expected.to be_a Packages::Downloadable } + describe 'relationships' do it { is_expected.to belong_to(:project) } it { is_expected.to belong_to(:creator) } @@ -1421,18 +1423,6 @@ RSpec.describe Packages::Package, type: :model, feature_category: :package_regis end end - describe '#touch_last_downloaded_at' do - let_it_be(:package) { create(:package) } - - subject { package.touch_last_downloaded_at } - - it 'updates the downloaded_at' do - expect(::Gitlab::Database::LoadBalancing::Session).to receive(:without_sticky_writes).and_call_original - expect { subject } - .to change(package, :last_downloaded_at).from(nil).to(instance_of(ActiveSupport::TimeWithZone)) - end - end - describe "#publish_creation_event" do let_it_be(:project) { create(:project) } |