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>2020-03-12 21:09:28 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-12 21:09:28 +0300
commitce8a0b90849ac5d1895e741c023432930f24d724 (patch)
treedbdc97de542cdbe18a2fc8b1a6b64ac0673ed3d3 /spec/support/shared_contexts
parentdc889678d1de8c09310b2f8f9742bb6c78a6f1a4 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_contexts')
-rw-r--r--spec/support/shared_contexts/upload_type_check_shared_context.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/support/shared_contexts/upload_type_check_shared_context.rb b/spec/support/shared_contexts/upload_type_check_shared_context.rb
index d29c498fd15..b0b569fe83f 100644
--- a/spec/support/shared_contexts/upload_type_check_shared_context.rb
+++ b/spec/support/shared_contexts/upload_type_check_shared_context.rb
@@ -20,6 +20,7 @@ RSpec.shared_context 'uploader with type check' do
end
end
+# This works with the UploadTypeCheck::Concern
RSpec.shared_context 'stubbed MimeMagic mime type detection' do
let(:mime_type) { '' }
let(:magic_mime) { mime_type }
@@ -31,3 +32,19 @@ RSpec.shared_context 'stubbed MimeMagic mime type detection' do
allow(MimeMagic).to receive(:by_path).with(anything).and_return(ext_mime_obj)
end
end
+
+# @param uploader [CarrierWave::Uploader::Base] uploader with extension_whitelist method.
+RSpec.shared_context 'ignore extension whitelist check' do
+ before do
+ allow(uploader).to receive(:extension_whitelist).and_return(nil)
+ end
+end
+
+# This works with a content_type_whitelist and content_type_blacklist type check.
+# @param mime_type [String] mime type to forcibly detect.
+RSpec.shared_context 'force content type detection to mime_type' do
+ before do
+ magic_mime_obj = MimeMagic.new(mime_type)
+ allow(MimeMagic).to receive(:by_magic).with(anything).and_return(magic_mime_obj)
+ end
+end