Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 11:17:02 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 11:17:02 +0300
commitb39512ed755239198a9c294b6a45e65c05900235 (patch)
treed234a3efade1de67c46b9e5a38ce813627726aa7 /spec/uploaders
parentd31474cf3b17ece37939d20082b07f6657cc79a9 (diff)
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'spec/uploaders')
-rw-r--r--spec/uploaders/avatar_uploader_spec.rb2
-rw-r--r--spec/uploaders/design_management/design_v432x230_uploader_spec.rb2
-rw-r--r--spec/uploaders/favicon_uploader_spec.rb8
-rw-r--r--spec/uploaders/object_storage_spec.rb18
4 files changed, 22 insertions, 8 deletions
diff --git a/spec/uploaders/avatar_uploader_spec.rb b/spec/uploaders/avatar_uploader_spec.rb
index 1fadd9425ef..a55e5c23fe8 100644
--- a/spec/uploaders/avatar_uploader_spec.rb
+++ b/spec/uploaders/avatar_uploader_spec.rb
@@ -52,7 +52,7 @@ RSpec.describe AvatarUploader do
# in a stub below so we can set any path.
let_it_be(:path) { File.join('spec', 'fixtures', 'video_sample.mp4') }
- where(:mime_type) { described_class::MIME_WHITELIST }
+ where(:mime_type) { described_class::MIME_ALLOWLIST }
with_them do
include_context 'force content type detection to mime_type'
diff --git a/spec/uploaders/design_management/design_v432x230_uploader_spec.rb b/spec/uploaders/design_management/design_v432x230_uploader_spec.rb
index b3a106ef94b..a18a37e73da 100644
--- a/spec/uploaders/design_management/design_v432x230_uploader_spec.rb
+++ b/spec/uploaders/design_management/design_v432x230_uploader_spec.rb
@@ -63,7 +63,7 @@ RSpec.describe DesignManagement::DesignV432x230Uploader do
# in a stub below so we can set any path.
let_it_be(:path) { File.join('spec', 'fixtures', 'dk.png') }
- where(:mime_type) { described_class::MIME_TYPE_WHITELIST }
+ where(:mime_type) { described_class::MIME_TYPE_ALLOWLIST }
with_them do
include_context 'force content type detection to mime_type'
diff --git a/spec/uploaders/favicon_uploader_spec.rb b/spec/uploaders/favicon_uploader_spec.rb
index 6bff3ff8a14..7f452075293 100644
--- a/spec/uploaders/favicon_uploader_spec.rb
+++ b/spec/uploaders/favicon_uploader_spec.rb
@@ -7,13 +7,13 @@ RSpec.describe FaviconUploader do
let_it_be(:uploader) { described_class.new(model, :favicon) }
context 'accept whitelist file content type' do
- include_context 'ignore extension whitelist check'
+ include_context 'ignore extension allowlist check'
# We need to feed through a valid path, but we force the parsed mime type
# in a stub below so we can set any path.
let_it_be(:path) { File.join('spec', 'fixtures', 'video_sample.mp4') }
- where(:mime_type) { described_class::MIME_WHITELIST }
+ where(:mime_type) { described_class::MIME_ALLOWLIST }
with_them do
include_context 'force content type detection to mime_type'
@@ -23,7 +23,7 @@ RSpec.describe FaviconUploader do
end
context 'upload non-whitelisted file content type' do
- include_context 'ignore extension whitelist check'
+ include_context 'ignore extension allowlist check'
let_it_be(:path) { File.join('spec', 'fixtures', 'sanitized.svg') }
@@ -31,7 +31,7 @@ RSpec.describe FaviconUploader do
end
context 'upload misnamed non-whitelisted file content type' do
- include_context 'ignore extension whitelist check'
+ include_context 'ignore extension allowlist check'
let_it_be(:path) { File.join('spec', 'fixtures', 'not_a_png.png') }
diff --git a/spec/uploaders/object_storage_spec.rb b/spec/uploaders/object_storage_spec.rb
index 1bcc43b81a8..a4f6116f7d7 100644
--- a/spec/uploaders/object_storage_spec.rb
+++ b/spec/uploaders/object_storage_spec.rb
@@ -256,8 +256,22 @@ RSpec.describe ObjectStorage do
describe '#use_open_file' do
context 'when file is stored locally' do
- it "returns the file" do
- expect { |b| uploader.use_open_file(&b) }.to yield_with_args(an_instance_of(ObjectStorage::Concern::OpenFile))
+ it "returns the file unlinked" do
+ expect { |b| uploader.use_open_file(&b) }.to yield_with_args(
+ satisfying do |f|
+ expect(f).to be_an_instance_of(ObjectStorage::Concern::OpenFile)
+ expect(f.file_path).to be_nil
+ end
+ )
+ end
+
+ it "returns the file not unlinked" do
+ expect { |b| uploader.use_open_file(unlink_early: false, &b) }.to yield_with_args(
+ satisfying do |f|
+ expect(f).to be_an_instance_of(ObjectStorage::Concern::OpenFile)
+ expect(File.exist?(f.file_path)).to be_truthy
+ end
+ )
end
end