Class: RuboCop::Cop::RSpec::SidekiqInline
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::RSpec::SidekiqInline
- Defined in:
- lib/rubocop/cop/rspec/sidekiq_inline.rb
Overview
Prevent using ‘Sidekiq::Testing.inline!` in spec. The method will execute inline every perform_async called. Must likely a spec want to test a specific worker and called it. If you don’t need to execute it, consider using ‘have_enqueued_sidekiq_job` matcher. Or if you need to perform the jobs in queue for this worker, use `drain` method on the worker class.
Constant Summary collapse
- MSG =
'Use `MyWorker.drain` method instead of `Sidekiq::Testing.inline!`.'
- RESTRICT_ON_SEND =
[:inline!].freeze
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
31 32 33 34 35 |
# File 'lib/rubocop/cop/rspec/sidekiq_inline.rb', line 31 def on_send(node) return unless sidekiq_inline?(node) add_offense(node) end |