Skip to content

Commit

Permalink
Specs
Browse files Browse the repository at this point in the history
  • Loading branch information
adarshaks91 committed Jun 25, 2024
1 parent a75a37e commit 77a0209
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Bugcrowd::PreventReindexFullESDocumentCop do
subject(:cop) { described_class.new(config) }

let(:config) { RuboCop::Config.new }

it 'registers an offence when reindexing a full elasticsearch document' do
expect_offense(<<~RUBY)
ValisCommands::ReindexDocument.call(document_type: 'SubmissionDocument')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Avoid reindexing the full Elasticsearch document. Consider reindexing only specific resource ids.
RUBY
end

it 'does not register an offense when reindexing only a specific resource ID' do
expect_no_offenses(<<~RUBY)
ValisReindexWorker.new.perform([submission.id], Submission.to_s)
RUBY
end
end

0 comments on commit 77a0209

Please sign in to comment.