Method: ReportPortal::RSpec::Formatter#example_group_started

Defined in:
lib/report_portal/rspec/formatter.rb

#example_group_started(group_notification) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/report_portal/rspec/formatter.rb', line 48

def example_group_started(group_notification)
  description = group_notification.group.description
  if description.size < MIN_DESCRIPTION_LENGTH
    p "Group description should be at least #{MIN_DESCRIPTION_LENGTH} characters ('group_notification': #{group_notification.inspect})"
    return
  end
  item = ReportPortal::TestItem.new(description[0..MAX_DESCRIPTION_LENGTH-1],
                                    :TEST,
                                    nil,
                                    ReportPortal.now,
                                    '',
                                    false,
                                    [])
  group_node = Tree::TreeNode.new(SecureRandom.hex, item)
  if group_node.nil?
    p "Group node is nil for item #{item.inspect}"
  else
    @current_group_node << group_node unless @current_group_node.nil? # make @current_group_node parent of group_node
    @current_group_node = group_node
    group_node.content.id = ReportPortal.start_item(group_node)
  end
end