Class: Group

Inherits:
Contextual::Node show all
Includes:
Contextual::Child, Contextual::Parent
Defined in:
lib/contextual/group.rb

Overview

A Group is a organizational class that holds other tests. You can nest as many groups as you like.

Instance Attribute Summary

Attributes included from Contextual::Parent

#children

Attributes inherited from Contextual::Node

#result, #skip

Instance Method Summary collapse

Methods included from Contextual::Parent

#assign_parent, #critical_inconclusive, #failures, #get_result, #neutrals, #report_children, #set_parent, #should_run_with_search_term_with_children, #successes, #total

Methods included from Contextual::Child

#assign_parent

Methods inherited from Contextual::Node

#get_result, #run, #run_setup, #run_teardown, #should_run_with_search_term

Constructor Details

#initialize(title, children = [], setup: nil, teardown: nil, options: nil, skip: false) ⇒ Group

Returns a new instance of Group.



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/contextual/group.rb', line 13

def initialize(
  title,
  children = [],
  setup: nil,
  teardown: nil,
  options: nil,
  skip: false
)
  super(title, setup: setup, teardown: teardown, options: options, skip: skip)
  set_parent(children)
end

Instance Method Details

#report(filter_settings) ⇒ TestResult, Nil

Report results, if any

Parameters:

Returns:



39
40
41
42
43
44
# File 'lib/contextual/group.rb', line 39

def report(filter_settings)
  @result.report(@parent_count)
  return if @skip

  report_children(filter_settings)
end

#should_run_with_filter(filter_settings) ⇒ Boolean

Should this run with the current filter settings

Parameters:

Returns:

  • (Boolean)


28
29
30
31
32
33
34
# File 'lib/contextual/group.rb', line 28

def should_run_with_filter(filter_settings)
  # This should run failrly close to testRunner's version
  return @title == filter_settings.group_search_for if filter_settings.has_group_search_for
  return @title.include? filter_settings.group_filter_term if filter_settings.has_group_filter_term

  should_run_with_search_term_with_children(filter_settings)
end