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-01-03 00:07:38 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-03 00:07:38 +0300
commit9d54184f308893338967b18874dedebf38acf89e (patch)
tree100e32c6d4b34deac52d9e98a083361d89804b50 /spec/uploaders/favicon_uploader_spec.rb
parentd5b5f5e6e1474d5526add9033c9754b8e395841f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/uploaders/favicon_uploader_spec.rb')
-rw-r--r--spec/uploaders/favicon_uploader_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/uploaders/favicon_uploader_spec.rb b/spec/uploaders/favicon_uploader_spec.rb
new file mode 100644
index 00000000000..4d6c849883a
--- /dev/null
+++ b/spec/uploaders/favicon_uploader_spec.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe FaviconUploader do
+ let_it_be(:model) { build_stubbed(:user) }
+ let_it_be(:uploader) { described_class.new(model, :favicon) }
+
+ context 'upload type check' do
+ FaviconUploader::EXTENSION_WHITELIST.each do |ext|
+ context "#{ext} extension" do
+ it_behaves_like 'type checked uploads', filenames: "image.#{ext}"
+ end
+ end
+ end
+
+ context 'upload non-whitelisted file extensions' do
+ it 'will deny upload' do
+ path = File.join('spec', 'fixtures', 'banana_sample.gif')
+ fixture_file = fixture_file_upload(path)
+ expect { uploader.cache!(fixture_file) }.to raise_exception(CarrierWave::IntegrityError)
+ end
+ end
+end