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: ...@@ -409,7 +409,6 @@ RSpec/LeakyConstantDeclaration:
- 'spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb' - '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/helpers/active_record/query_recorder_spec.rb'
- 'spec/support_specs/matchers/exceed_query_limit_helpers_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' - 'spec/uploaders/records_uploads_spec.rb'
RSpec/EmptyLineAfterHook: 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 @@ ...@@ -3,7 +3,11 @@
require 'spec_helper' require 'spec_helper'
describe ContentTypeWhitelist do 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 include ContentTypeWhitelist::Concern
def content_type_whitelist def content_type_whitelist
...@@ -11,8 +15,8 @@ describe ContentTypeWhitelist do ...@@ -11,8 +15,8 @@ describe ContentTypeWhitelist do
end end
end end
let_it_be(:model) { build_stubbed(:user) } DummyUploader.new(model, :dummy)
let_it_be(:uploader) { DummyUploader.new(model, :dummy) } end
context 'upload whitelisted file content type' do context 'upload whitelisted file content type' do
let(:path) { File.join('spec', 'fixtures', 'rails_sample.jpg') } 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