2020-06-05 11:08:23 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-06-17 02:08:43 -04:00
|
|
|
require 'fast_spec_helper'
|
2020-06-05 11:08:23 -04:00
|
|
|
require_relative '../../../../rubocop/cop/gitlab/bulk_insert'
|
|
|
|
|
2021-01-07 13:10:38 -05:00
|
|
|
RSpec.describe RuboCop::Cop::Gitlab::BulkInsert do
|
2020-06-05 11:08:23 -04:00
|
|
|
subject(:cop) { described_class.new }
|
|
|
|
|
2021-07-29 11:09:48 -04:00
|
|
|
it 'flags the use of Gitlab::Database.main.bulk_insert' do
|
2020-06-05 11:08:23 -04:00
|
|
|
expect_offense(<<~SOURCE)
|
2021-07-29 11:09:48 -04:00
|
|
|
Gitlab::Database.main.bulk_insert('merge_request_diff_files', rows)
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use the `BulkInsertSafe` concern, [...]
|
2020-09-14 23:09:24 -04:00
|
|
|
SOURCE
|
|
|
|
end
|
|
|
|
|
2021-07-29 11:09:48 -04:00
|
|
|
it 'flags the use of ::Gitlab::Database.main.bulk_insert' do
|
2020-09-14 23:09:24 -04:00
|
|
|
expect_offense(<<~SOURCE)
|
2021-07-29 11:09:48 -04:00
|
|
|
::Gitlab::Database.main.bulk_insert('merge_request_diff_files', rows)
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Use the `BulkInsertSafe` concern, [...]
|
2020-06-05 11:08:23 -04:00
|
|
|
SOURCE
|
|
|
|
end
|
|
|
|
end
|