2019-10-29 08:06:40 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-06-17 02:08:43 -04:00
|
|
|
require 'fast_spec_helper'
|
2017-09-19 11:25:42 -04:00
|
|
|
|
2017-12-12 11:21:00 -05:00
|
|
|
require_relative '../../../rubocop/cop/include_sidekiq_worker'
|
|
|
|
|
2021-01-07 13:10:38 -05:00
|
|
|
RSpec.describe RuboCop::Cop::IncludeSidekiqWorker do
|
2017-12-12 11:21:00 -05:00
|
|
|
subject(:cop) { described_class.new }
|
|
|
|
|
|
|
|
context 'when `Sidekiq::Worker` is included' do
|
2021-02-09 01:09:21 -05: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 11:21:00 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|