Class: Probatio::Recorder

Inherits:
Object
  • Object
show all
Defined in:
lib/probatio/plugins.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#eventsObject (readonly)

Returns the value of attribute events.



14
15
16
# File 'lib/probatio/plugins.rb', line 14

def events
  @events
end

Instance Method Details

#assertion_countObject



39
# File 'lib/probatio/plugins.rb', line 39

def assertion_count; @events.count { |e| e.name == 'assertion_leave' }; end

#failed_testsObject



36
# File 'lib/probatio/plugins.rb', line 36

def failed_tests; @events.select { |e| e.name == 'test_fail' }; end

#failure_countObject



40
# File 'lib/probatio/plugins.rb', line 40

def failure_count; @events.count { |e| e.name == 'test_fail' }; end

#failuresObject



21
# File 'lib/probatio/plugins.rb', line 21

def failures; @events.select { |ev| ev.name == 'test_fail' }; end

#file_countObject



43
44
45
46
# File 'lib/probatio/plugins.rb', line 43

def file_count

  @events.map(&:path).compact.uniq.count
end

#pending_countObject



41
# File 'lib/probatio/plugins.rb', line 41

def pending_count; @events.count { |e| e.name == 'test_pending' }; end

#record(ev) ⇒ Object



16
17
18
19
# File 'lib/probatio/plugins.rb', line 16

def record(ev)

  (@events ||= []) << ev
end

#successesObject



22
# File 'lib/probatio/plugins.rb', line 22

def successes; @events.select { |ev| ev.name == 'test_succeed' }; end

#test_countObject



38
# File 'lib/probatio/plugins.rb', line 38

def test_count; @events.count { |e| e.name == 'test_leave' }; end

#test_leave_event(test_node) ⇒ Object



24
25
26
27
28
29
# File 'lib/probatio/plugins.rb', line 24

def test_leave_event(test_node)

  @events.find { |e|
    e.name == 'test_leave' &&
    e.node_full_name == test_node.full_name }
end

#total_durationObject



31
32
33
34
# File 'lib/probatio/plugins.rb', line 31

def total_duration

  @events.last.tstamp - @events.first.tstamp
end