...@@ -6,19 +6,35 @@ describe FaviconUploader do ...@@ -6,19 +6,35 @@ describe FaviconUploader do
let_it_be(:model) { build_stubbed(:user) } let_it_be(:model) { build_stubbed(:user) }
let_it_be(:uploader) { described_class.new(model, :favicon) } let_it_be(:uploader) { described_class.new(model, :favicon) }
context 'upload type check' do context 'accept whitelist file content type' do
FaviconUploader::EXTENSION_WHITELIST.each do |ext| include_context 'ignore extension whitelist check'
context "#{ext} extension" do
it_behaves_like 'type checked uploads', filenames: "image.#{ext}" # We need to feed through a valid path, but we force the parsed mime type
end # in a stub below so we can set any path.
let_it_be(:path) { File.join('spec', 'fixtures', 'video_sample.mp4') }
where(:mime_type) { described_class::MIME_WHITELIST }
with_them do
include_context 'force content type detection to mime_type'
it_behaves_like 'accepted carrierwave upload'
end end
end end
context 'upload non-whitelisted file extensions' do context 'upload non-whitelisted file content type' do
it 'will deny upload' do include_context 'ignore extension whitelist check'
path = File.join('spec', 'fixtures', 'banana_sample.gif')
fixture_file = fixture_file_upload(path) let_it_be(:path) { File.join('spec', 'fixtures', 'sanitized.svg') }
expect { uploader.cache!(fixture_file) }.to raise_exception(CarrierWave::IntegrityError)
it_behaves_like 'denied carrierwave upload'
end end
context 'upload misnamed non-whitelisted file content type' do
include_context 'ignore extension whitelist check'
let_it_be(:path) { File.join('spec', 'fixtures', 'not_a_png.png') }
it_behaves_like 'denied carrierwave upload'
end end
end end
...@@ -166,7 +166,6 @@ describe 'layouts/nav/sidebar/_project' do ...@@ -166,7 +166,6 @@ describe 'layouts/nav/sidebar/_project' do
before do before do
allow(view).to receive(:can?).with(nil, :read_cycle_analytics, project).and_return(read_cycle_analytics) allow(view).to receive(:can?).with(nil, :read_cycle_analytics, project).and_return(read_cycle_analytics)
stub_feature_flags(analytics_pages_under_project_analytics_sidebar: { enabled: false, thing: project })
end end
describe 'when value stream analytics is enabled' do describe 'when value stream analytics is enabled' do
... ...
......
...@@ -26,17 +26,5 @@ describe UpdateMergeRequestsWorker do ...@@ -26,17 +26,5 @@ describe UpdateMergeRequestsWorker do
perform perform
end end
context 'when slow' do
before do
stub_const("UpdateMergeRequestsWorker::LOG_TIME_THRESHOLD", -1)
end
it 'logs debug info' do
expect(Rails.logger).to receive(:info).with(a_string_matching(/\AUpdateMergeRequestsWorker#perform.*project_id=#{project.id},user_id=#{user.id},oldrev=#{oldrev},newrev=#{newrev},ref=#{ref}/))
perform
end
end
end end
end end