summaryrefslogtreecommitdiff
path: root/spec/rubocop/cop/gitlab/avoid_uploaded_file_from_params_spec.rb
blob: f96e25c59e7c0d7ece37ec1d7e059182bae08954 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

require 'fast_spec_helper'
require 'rubocop'
require_relative '../../../../rubocop/cop/gitlab/avoid_uploaded_file_from_params'

RSpec.describe RuboCop::Cop::Gitlab::AvoidUploadedFileFromParams do
  subject(:cop) { described_class.new }

  context 'when using UploadedFile.from_params' do
    it 'flags its call' do
      expect_offense(<<~SOURCE)
        UploadedFile.from_params(params)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use the `UploadedFile` set by `multipart.rb` instead of calling [...]
      SOURCE
    end
  end
end