Welcome to mirror list, hosted at ThFree Co, Russian Federation.

modify_sidekiq_middleware_spec.rb « rspec « cop « rubocop « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3227b075758de86969b637502bfcc56523032192 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

require 'rubocop_spec_helper'
require_relative '../../../../rubocop/cop/rspec/modify_sidekiq_middleware'

RSpec.describe RuboCop::Cop::RSpec::ModifySidekiqMiddleware do
  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
  end
end