Class: ATP::Processors::Relationship::ExtractTestResults

Inherits:
ATP::Processor
  • Object
show all
Defined in:
lib/atp/processors/relationship.rb

Overview

Extracts all test-result nodes from the given AST

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ATP::Processor

#handler_missing, #n, #n0, #n1, #process, #run

Instance Attribute Details

#resultsObject (readonly)

Returns the value of attribute results.



12
13
14
# File 'lib/atp/processors/relationship.rb', line 12

def results
  @results
end

Instance Method Details

#on_test_executed(node) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/atp/processors/relationship.rb', line 30

def on_test_executed(node)
  id, state, *children = *node
  id, state = *node
  results[id] ||= {}
  results[id][:executed] = true
  process_all(children)
end

#on_test_result(node) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/atp/processors/relationship.rb', line 14

def on_test_result(node)
  ids, state, *children = *node
  unless ids.is_a?(Array)
    ids = [ids]
  end
  ids.each do |id|
    results[id] ||= {}
    if state
      results[id][:passed] = true
    else
      results[id][:failed] = true
    end
  end
  process_all(children)
end