2019-10-29 12:06:40 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-08-18 18:10:07 +00:00
|
|
|
require 'rubocop_spec_helper'
|
2017-09-19 15:25:42 +00:00
|
|
|
|
2017-12-12 16:21:00 +00:00
|
|
|
require_relative '../../../rubocop/cop/include_sidekiq_worker'
|
|
|
|
|
2021-01-07 18:10:38 +00:00
|
|
|
RSpec.describe RuboCop::Cop::IncludeSidekiqWorker do
|
2017-12-12 16:21:00 +00:00
|
|
|
context 'when `Sidekiq::Worker` is included' do
|
2021-02-09 06:09:21 +00:00
|
|
|
it 'registers an offense and corrects', :aggregate_failures do
|
|
|
|
expect_offense(<<~CODE)
|
|
|
|
include Sidekiq::Worker
|
|
|
|
^^^^^^^^^^^^^^^ Include `ApplicationWorker`, not `Sidekiq::Worker`.
|
|
|
|
CODE
|
|
|
|
|
|
|
|
expect_correction(<<~CODE)
|
|
|
|
include ApplicationWorker
|
|
|
|
CODE
|
2017-12-12 16:21:00 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|