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