Commit 6635dc0a authored by Rajendra Kadam's avatar Rajendra Kadam Committed by Peter Leitzen

Stub class in content whitelist spec

parent 1c45e75d
......@@ -409,7 +409,6 @@ RSpec/LeakyConstantDeclaration:
- 'spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb'
- 'spec/support_specs/helpers/active_record/query_recorder_spec.rb'
- 'spec/support_specs/matchers/exceed_query_limit_helpers_spec.rb'
- 'spec/uploaders/content_type_whitelist_spec.rb'
- 'spec/uploaders/records_uploads_spec.rb'
RSpec/EmptyLineAfterHook:
......
---
title: Add class stubs and fix leaky constant alert in content whitelist spec
merge_request: 31946
author: Rajendra Kadam
type: fixed
......@@ -3,16 +3,20 @@
require 'spec_helper'
describe ContentTypeWhitelist do
class DummyUploader < CarrierWave::Uploader::Base
include ContentTypeWhitelist::Concern
let_it_be(:model) { build_stubbed(:user) }
let!(:uploader) do
stub_const('DummyUploader', Class.new(CarrierWave::Uploader::Base))
DummyUploader.class_eval do
include ContentTypeWhitelist::Concern
def content_type_whitelist
%w[image/png image/jpeg]
def content_type_whitelist
%w[image/png image/jpeg]
end
end
end
let_it_be(:model) { build_stubbed(:user) }
let_it_be(:uploader) { DummyUploader.new(model, :dummy) }
DummyUploader.new(model, :dummy)
end
context 'upload whitelisted file content type' do
let(:path) { File.join('spec', 'fixtures', 'rails_sample.jpg') }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment