2019-12-26 22:10:19 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-10-11 01:57:18 +05:30
|
|
|
require 'rubocop_spec_helper'
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
require_relative '../../../rubocop/cop/include_sidekiq_worker'
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
RSpec.describe RuboCop::Cop::IncludeSidekiqWorker do
|
2018-03-17 18:26:18 +05:30
|
|
|
context 'when `Sidekiq::Worker` is included' do
|
2021-03-11 19:13:27 +05:30
|
|
|
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
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|