Class: ATP::Processors::PostCleaner

Inherits:
ATP::Processor show all
Defined in:
lib/atp/processors/post_cleaner.rb

Overview

Runs at the very end of a processor run, to do some final cleanup, e.g. to assign generated IDs to tests that don’t have one

Defined Under Namespace

Classes: ExtractTestIDs

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ATP::Processor

#handler_missing, #n, #n0, #n1, #n2, #run

Instance Attribute Details

#idsObject (readonly)

Returns a hash containing the IDs of all tests that have been used



8
9
10
# File 'lib/atp/processors/post_cleaner.rb', line 8

def ids
  @ids
end

Instance Method Details

#on_test(node) ⇒ Object



39
40
# File 'lib/atp/processors/post_cleaner.rb', line 39

def on_test(node)
end

#process(node) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/atp/processors/post_cleaner.rb', line 23

def process(node)
  # On first call extract the test_result nodes from the given AST,
  # then process as normal thereafter
  if @first_call_done
    result = super
  else
    @first_call_done = true
    t = ExtractTestIDs.new
    t.process(node)
    @ids = t.results || {}
    result = super
    @first_call_done = false
  end
  result
end