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/sidekiq_options_queue'
|
|
|
|
|
2021-01-07 13:10:38 -05:00
|
|
|
RSpec.describe RuboCop::Cop::SidekiqOptionsQueue do
|
2017-12-12 11:21:00 -05:00
|
|
|
subject(:cop) { described_class.new }
|
|
|
|
|
|
|
|
it 'registers an offense when `sidekiq_options` is used with the `queue` option' do
|
2021-02-17 16:09:06 -05:00
|
|
|
expect_offense(<<~CODE)
|
|
|
|
sidekiq_options queue: "some_queue"
|
|
|
|
^^^^^^^^^^^^^^^^^^^ Do not manually set a queue; `ApplicationWorker` sets one automatically.
|
|
|
|
CODE
|
2017-12-12 11:21:00 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not register an offense when `sidekiq_options` is used with another option' do
|
2021-02-17 16:09:06 -05:00
|
|
|
expect_no_offenses('sidekiq_options retry: false')
|
2017-12-12 11:21:00 -05:00
|
|
|
end
|
|
|
|
end
|