2020-09-04 18:08:48 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'fast_spec_helper'
|
|
|
|
require_relative '../../../../rubocop/cop/gitlab/avoid_uploaded_file_from_params'
|
|
|
|
|
2021-01-07 18:10:38 +00:00
|
|
|
RSpec.describe RuboCop::Cop::Gitlab::AvoidUploadedFileFromParams do
|
2020-09-04 18:08:48 +00:00
|
|
|
subject(:cop) { described_class.new }
|
|
|
|
|
2021-01-26 18:09:30 +00:00
|
|
|
context 'when using UploadedFile.from_params' do
|
2020-09-04 18:08:48 +00:00
|
|
|
it 'flags its call' do
|
|
|
|
expect_offense(<<~SOURCE)
|
2021-01-26 18:09:30 +00:00
|
|
|
UploadedFile.from_params(params)
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use the `UploadedFile` set by `multipart.rb` instead of calling [...]
|
2020-09-04 18:08:48 +00:00
|
|
|
SOURCE
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|