Class: Amigo::SpecHelpers::ServerCallbackMiddleware

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::ServerMiddleware
Defined in:
lib/amigo/spec_helpers.rb

Overview

Use this middleware to pass an arbitrary callback evaluated before a job runs. Make sure to call reset after the test.

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.callbackObject

Returns the value of attribute callback.



307
308
309
# File 'lib/amigo/spec_helpers.rb', line 307

def callback
  @callback
end

Class Method Details

.call(worker, job, queue) ⇒ Object



319
320
321
322
# File 'lib/amigo/spec_helpers.rb', line 319

def self.call(worker, job, queue)
  self.callback[worker, job, queue] if self.callback
  yield
end

.newObject



315
316
317
# File 'lib/amigo/spec_helpers.rb', line 315

def self.new
  return self
end

.resetObject



310
311
312
313
# File 'lib/amigo/spec_helpers.rb', line 310

def self.reset
  self.callback = nil
  return self
end