diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-04 21:08:48 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-04 21:08:48 +0300 |
commit | b3555357704e2776fc0c960eaf931b0e9b0f0ddf (patch) | |
tree | f51538bb1cd4b1fcb5981b38e31dc13d40381ff6 /spec/rubocop/cop/gitlab | |
parent | adf76f8f1d6da3ecbd8aa5d2da68dc8456283e8f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/rubocop/cop/gitlab')
-rw-r--r-- | spec/rubocop/cop/gitlab/avoid_uploaded_file_from_params_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/rubocop/cop/gitlab/avoid_uploaded_file_from_params_spec.rb b/spec/rubocop/cop/gitlab/avoid_uploaded_file_from_params_spec.rb new file mode 100644 index 00000000000..8341b0cab3a --- /dev/null +++ b/spec/rubocop/cop/gitlab/avoid_uploaded_file_from_params_spec.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require 'fast_spec_helper' +require 'rubocop' +require 'rubocop/rspec/support' +require_relative '../../../../rubocop/cop/gitlab/avoid_uploaded_file_from_params' + +RSpec.describe RuboCop::Cop::Gitlab::AvoidUploadedFileFromParams, type: :rubocop do + include CopHelper + + subject(:cop) { described_class.new } + + context '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 `UploadedFile.from_params` directly. See https://docs.gitlab.com/ee/development/uploads.html#how-to-add-a-new-upload-route + SOURCE + end + end +end |