Class: Amigo::SpecHelpers::ServerCallbackMiddleware

Inherits:
Object
  • Object
show all
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.



286
287
288
# File 'lib/amigo/spec_helpers.rb', line 286

def callback
  @callback
end

Class Method Details

.call(worker, job, queue) ⇒ Object



298
299
300
301
# File 'lib/amigo/spec_helpers.rb', line 298

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

.newObject



294
295
296
# File 'lib/amigo/spec_helpers.rb', line 294

def self.new
  return self
end

.resetObject



289
290
291
292
# File 'lib/amigo/spec_helpers.rb', line 289

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