Class: BackgroundLite::TestHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/background_lite/core_ext/handlers/test_handler.rb

Overview

This handler is used in a testing environment. It allows for introspection of last call to the handle method.

Class Method Summary collapse

Class Method Details

.handle(object, method, args, options = {}) ⇒ Object

Does not call the block, but sets some variables for introspection.



20
21
22
23
24
25
26
27
28
# File 'lib/background_lite/core_ext/handlers/test_handler.rb', line 20

def self.handle(object, method, args, options = {})
  self.executed = true
  if self.fail_next_time
    self.fail_next_time = false
    raise "TestHandler.handle: Failed on purpose"
  end
  
  self.object, self.method, self.args, self.options = object, method, args, options
end

.resetObject

Resets the class’ accessors.



31
32
33
# File 'lib/background_lite/core_ext/handlers/test_handler.rb', line 31

def self.reset
  object = method = args = options = fail_next_time = executed = nil
end