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.



279
280
281
# File 'lib/amigo/spec_helpers.rb', line 279

def callback
  @callback
end

Class Method Details

.call(worker, job, queue) ⇒ Object



291
292
293
294
# File 'lib/amigo/spec_helpers.rb', line 291

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

.newObject



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

def self.new
  return self
end

.resetObject



282
283
284
285
# File 'lib/amigo/spec_helpers.rb', line 282

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