Commit 94b29be5 authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'leaky-constant-fix-2' into 'master'

Stub class in content whitelist spec

See merge request gitlab-org/gitlab!31946
parents 13607270 6635dc0a
......@@ -404,7 +404,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,7 +3,11 @@
require 'spec_helper'
describe ContentTypeWhitelist do
class DummyUploader < CarrierWave::Uploader::Base
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
......@@ -11,8 +15,8 @@ describe ContentTypeWhitelist do
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