Class: FluQ::Handler::Test

Inherits:
Base
  • Object
show all
Defined in:
lib/fluq/testing.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#config, #name

Instance Method Summary collapse

Methods inherited from Base

#timers, type

Methods included from Mixins::Loggable

#logger

Constructor Details

#initializeTest

Returns a new instance of Test.



18
19
20
21
# File 'lib/fluq/testing.rb', line 18

def initialize(*)
  super
  @events = []
end

Instance Attribute Details

#eventsObject (readonly)

Returns the value of attribute events.



16
17
18
# File 'lib/fluq/testing.rb', line 16

def events
  @events
end

Instance Method Details

#filter(events) ⇒ Object



23
24
25
# File 'lib/fluq/testing.rb', line 23

def filter(events)
  events.reject {|e| e.key?("filter") }
end

#on_events(events) ⇒ Object

Raises:

  • (RuntimeError)


27
28
29
30
# File 'lib/fluq/testing.rb', line 27

def on_events(events)
  raise RuntimeError, "Test Failure!" if events.any? {|e| e.key?("error") }
  @events.concat events
end