2020-04-22 19:07:51 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-10-11 01:57:18 +05:30
|
|
|
require 'rubocop_spec_helper'
|
2020-04-22 19:07:51 +05:30
|
|
|
require_relative '../../../../rubocop/cop/rspec/modify_sidekiq_middleware'
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
RSpec.describe RuboCop::Cop::RSpec::ModifySidekiqMiddleware do
|
2021-03-11 19:13:27 +05:30
|
|
|
it 'registers an offense and corrects', :aggregate_failures do
|
|
|
|
expect_offense(<<~CODE)
|
|
|
|
Sidekiq::Testing.server_middleware do |chain|
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Don't modify global sidekiq middleware, [...]
|
|
|
|
chain.add(MyCustomMiddleware)
|
|
|
|
end
|
|
|
|
CODE
|
|
|
|
|
|
|
|
expect_correction(<<~CODE)
|
|
|
|
with_sidekiq_server_middleware do |chain|
|
|
|
|
chain.add(MyCustomMiddleware)
|
|
|
|
end
|
|
|
|
CODE
|
2020-04-22 19:07:51 +05:30
|
|
|
end
|
|
|
|
end
|