Class: Liza::TestTreePart
- Defined in:
- lib/liza/safety_parts/test_tree_part.rb
Instance Attribute Summary collapse
-
#after_stack ⇒ Object
readonly
Returns the value of attribute after_stack.
-
#before_stack ⇒ Object
readonly
Returns the value of attribute before_stack.
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#tests ⇒ Object
readonly
Returns the value of attribute tests.
Instance Method Summary collapse
- #add_after(&block) ⇒ Object
- #add_before(&block) ⇒ Object
- #add_test(words, &block) ⇒ Object
- #branch_out(words, &block) ⇒ Object
-
#initialize(parent, before_stack, after_stack) ⇒ TestTreePart
constructor
A new instance of TestTreePart.
- #initialize_filters(before_stack, after_stack) ⇒ Object
- #initialize_parenting(parent) ⇒ Object
- #log_test_building? ⇒ Boolean
Methods inherited from Part
Methods inherited from Unit
const_missing, division, part, system, #system, test_class
Constructor Details
#initialize(parent, before_stack, after_stack) ⇒ TestTreePart
Returns a new instance of TestTreePart.
49 50 51 52 53 |
# File 'lib/liza/safety_parts/test_tree_part.rb', line 49 def initialize parent, before_stack, after_stack @tests = [] initialize_parenting parent initialize_filters before_stack, after_stack end |
Instance Attribute Details
#after_stack ⇒ Object (readonly)
Returns the value of attribute after_stack.
47 48 49 |
# File 'lib/liza/safety_parts/test_tree_part.rb', line 47 def after_stack @after_stack end |
#before_stack ⇒ Object (readonly)
Returns the value of attribute before_stack.
47 48 49 |
# File 'lib/liza/safety_parts/test_tree_part.rb', line 47 def before_stack @before_stack end |
#children ⇒ Object (readonly)
Returns the value of attribute children.
47 48 49 |
# File 'lib/liza/safety_parts/test_tree_part.rb', line 47 def children @children end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
47 48 49 |
# File 'lib/liza/safety_parts/test_tree_part.rb', line 47 def parent @parent end |
#tests ⇒ Object (readonly)
Returns the value of attribute tests.
47 48 49 |
# File 'lib/liza/safety_parts/test_tree_part.rb', line 47 def tests @tests end |
Instance Method Details
#add_after(&block) ⇒ Object
77 78 79 80 |
# File 'lib/liza/safety_parts/test_tree_part.rb', line 77 def add_after &block log "add_after to ##{object_id} #{block}" if log_test_building? @after_top.push block end |
#add_before(&block) ⇒ Object
67 68 69 70 |
# File 'lib/liza/safety_parts/test_tree_part.rb', line 67 def add_before &block log "add_before to ##{object_id} #{block}" if log_test_building? @before_top.push block end |
#add_test(words, &block) ⇒ Object
72 73 74 75 |
# File 'lib/liza/safety_parts/test_tree_part.rb', line 72 def add_test words, &block log "add_test to ##{object_id} #{words} #{block}" if log_test_building? tests << [words, block] end |
#branch_out(words, &block) ⇒ Object
82 83 84 |
# File 'lib/liza/safety_parts/test_tree_part.rb', line 82 def branch_out words, &block self.class.new self, before_stack.dup, after_stack.dup end |
#initialize_filters(before_stack, after_stack) ⇒ Object
61 62 63 64 65 |
# File 'lib/liza/safety_parts/test_tree_part.rb', line 61 def initialize_filters before_stack, after_stack @before_top, @after_top = [], [] @before_stack = before_stack.push @before_top @after_stack = after_stack.unshift @after_top end |
#initialize_parenting(parent) ⇒ Object
55 56 57 58 59 |
# File 'lib/liza/safety_parts/test_tree_part.rb', line 55 def initialize_parenting parent @parent = parent || self @children = [] @parent.children << self if @parent != self end |