2019-12-26 22:10:19 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
require 'fast_spec_helper'
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
require_relative '../../../rubocop/cop/sidekiq_options_queue'
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
RSpec.describe RuboCop::Cop::SidekiqOptionsQueue do
|
2018-03-17 18:26:18 +05:30
|
|
|
subject(:cop) { described_class.new }
|
|
|
|
|
|
|
|
it 'registers an offense when `sidekiq_options` is used with the `queue` option' do
|
2021-04-17 20:07:23 +05:30
|
|
|
expect_offense(<<~CODE)
|
|
|
|
sidekiq_options queue: "some_queue"
|
|
|
|
^^^^^^^^^^^^^^^^^^^ Do not manually set a queue; `ApplicationWorker` sets one automatically.
|
|
|
|
CODE
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'does not register an offense when `sidekiq_options` is used with another option' do
|
2021-04-17 20:07:23 +05:30
|
|
|
expect_no_offenses('sidekiq_options retry: false')
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
end
|