debian-mirror-gitlab/spec/rubocop/cop/scalability/idempotent_worker_spec.rb
2022-10-11 01:57:18 +05:30

28 lines
656 B
Ruby

# frozen_string_literal: true
require 'rubocop_spec_helper'
require_relative '../../../../rubocop/cop/scalability/idempotent_worker'
RSpec.describe RuboCop::Cop::Scalability::IdempotentWorker do
before do
allow(cop)
.to receive(:in_worker?)
.and_return(true)
end
it 'adds an offense when not defining idempotent method' do
expect_offense(<<~CODE)
class SomeWorker
^^^^^^^^^^^^^^^^ Avoid adding not idempotent workers.[...]
end
CODE
end
it 'adds an offense when not defining idempotent method' do
expect_no_offenses(<<~CODE)
class SomeWorker
idempotent!
end
CODE
end
end