Class: Rutema::Reporters::Collector

Inherits:
EventReporter show all
Defined in:
lib/rutema/core/reporter.rb

Overview

This reporter is always instantiated and collects all messages fired by the rutema engine

The collections of errors and states are then at the end of a run fed to the block reporters

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from EventReporter

#exit, #run!

Constructor Details

#initialize(params, dispatcher) ⇒ Collector



79
80
81
82
83
# File 'lib/rutema/core/reporter.rb', line 79

def initialize(params, dispatcher)
  super
  @errors = []
  @states = {}
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



77
78
79
# File 'lib/rutema/core/reporter.rb', line 77

def errors
  @errors
end

#statesObject (readonly)

Returns the value of attribute states.



77
78
79
# File 'lib/rutema/core/reporter.rb', line 77

def states
  @states
end

Instance Method Details

#update(message) ⇒ Object



85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/rutema/core/reporter.rb', line 85

def update(message)
  case message
  when RunnerMessage
    test_state = @states[message.test]
    if test_state
      test_state << message
    else
      test_state = Rutema::ReportState.new(message)
    end
    @states[message.test] = test_state
  when ErrorMessage
    @errors << message
  end
end