diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-09 15:15:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-09 15:15:13 +0300 |
commit | 0b4adad74b76b34855e9a6d943f9b9188c3914fa (patch) | |
tree | 1084ffd8336bc8e9af6f7042a093bf78e0852ac3 /spec/uploaders | |
parent | ece36a21699c2a218b8bd14b22bea47d22218354 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/uploaders')
-rw-r--r-- | spec/uploaders/packages/npm/metadata_cache_uploader_spec.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/uploaders/packages/npm/metadata_cache_uploader_spec.rb b/spec/uploaders/packages/npm/metadata_cache_uploader_spec.rb new file mode 100644 index 00000000000..0bcf05932a5 --- /dev/null +++ b/spec/uploaders/packages/npm/metadata_cache_uploader_spec.rb @@ -0,0 +1,34 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Packages::Npm::MetadataCacheUploader, feature_category: :package_registry do + let(:object_storage_key) { 'object/storage/key' } + let(:npm_metadata_cache) { build_stubbed(:npm_metadata_cache, object_storage_key: object_storage_key) } + + subject { described_class.new(npm_metadata_cache, :file) } + + describe '#filename' do + it 'returns metadata.json' do + expect(subject.filename).to eq('metadata.json') + end + end + + describe '#store_dir' do + it 'uses the object_storage_key' do + expect(subject.store_dir).to eq(object_storage_key) + end + + context 'without the object_storage_key' do + let(:object_storage_key) { nil } + + it 'raises the error' do + expect { subject.store_dir } + .to raise_error( + described_class::ObjectNotReadyError, + 'Packages::Npm::MetadataCache model not ready' + ) + end + end + end +end |