Method: Amigo::SpecHelpers.sidekiq_perform_inline
- Defined in:
- lib/amigo/spec_helpers.rb
.sidekiq_perform_inline(klass, args, item = nil) ⇒ Object
Like a Sidekiq worker’s perform_inline, but allows an arbitrary item to be used, rather than just the given class and args. For example, when testing, you may need to assume something like ‘retry_count’ is in the job payload, but that can’t be included with perform_inline. This allows those arbitrary job payload fields to be included when the job is run.
258 259 260 261 262 263 264 265 |
# File 'lib/amigo/spec_helpers.rb', line 258 module_function def sidekiq_perform_inline(klass, args, item=nil) Sidekiq::Worker::Setter.override_item = item begin klass.perform_inline(*args) ensure Sidekiq::Worker::Setter.override_item = nil end end |