Class: Hiptest::Nodes::TestPlan

Inherits:
Node
  • Object
show all
Defined in:
lib/hiptest-publisher/nodes.rb

Instance Attribute Summary

Attributes inherited from Node

#children, #parent

Instance Method Summary collapse

Methods inherited from Node

#direct_children, #find_sub_nodes, #render

Constructor Details

#initialize(folders = []) ⇒ TestPlan

Returns a new instance of TestPlan.



326
327
328
329
330
331
332
333
# File 'lib/hiptest-publisher/nodes.rb', line 326

def initialize(folders = [])
  super()
  @uids_mapping = {}
  @children = {
    :root_folder => nil,
    :folders => folders
  }
end

Instance Method Details

#find_folder_by_uid(uid) ⇒ Object



349
350
351
# File 'lib/hiptest-publisher/nodes.rb', line 349

def find_folder_by_uid(uid)
  return @uids_mapping[uid]
end

#organize_foldersObject



335
336
337
338
339
340
341
342
343
344
345
346
347
# File 'lib/hiptest-publisher/nodes.rb', line 335

def organize_folders
  @children[:folders].each do |folder|
    @uids_mapping[folder.uid] = folder
    parent = find_folder_by_uid folder.parent_uid
    if parent.nil?
      @children[:root_folder] = folder
      next
    end

    folder.parent = parent
    parent.children[:subfolders] << folder
  end
end