Class: Liza::Test::Tree
- Inherits:
-
Object
- Object
- Liza::Test::Tree
- Defined in:
- lib/liza/helper_units/test.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) ⇒ Tree
constructor
A new instance of Tree.
- #initialize_filters(before_stack, after_stack) ⇒ Object
- #initialize_parenting(parent) ⇒ Object
- #log_test_building? ⇒ Boolean
Constructor Details
#initialize(parent, before_stack, after_stack) ⇒ Tree
Returns a new instance of Tree.
887 888 889 890 891 |
# File 'lib/liza/helper_units/test.rb', line 887 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.
885 886 887 |
# File 'lib/liza/helper_units/test.rb', line 885 def after_stack @after_stack end |
#before_stack ⇒ Object (readonly)
Returns the value of attribute before_stack.
885 886 887 |
# File 'lib/liza/helper_units/test.rb', line 885 def before_stack @before_stack end |
#children ⇒ Object (readonly)
Returns the value of attribute children.
885 886 887 |
# File 'lib/liza/helper_units/test.rb', line 885 def children @children end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
885 886 887 |
# File 'lib/liza/helper_units/test.rb', line 885 def parent @parent end |
#tests ⇒ Object (readonly)
Returns the value of attribute tests.
885 886 887 |
# File 'lib/liza/helper_units/test.rb', line 885 def tests @tests end |
Instance Method Details
#add_after(&block) ⇒ Object
915 916 917 918 |
# File 'lib/liza/helper_units/test.rb', line 915 def add_after &block puts "#{self.class} add_after to ##{object_id} #{block}" if log_test_building? @after_top.push block end |
#add_before(&block) ⇒ Object
905 906 907 908 |
# File 'lib/liza/helper_units/test.rb', line 905 def add_before &block puts "#{self.class} add_before to ##{object_id} #{block}" if log_test_building? @before_top.push block end |
#add_test(words, &block) ⇒ Object
910 911 912 913 |
# File 'lib/liza/helper_units/test.rb', line 910 def add_test words, &block puts "#{self.class} add_test to ##{object_id} #{words} #{block}" if log_test_building? tests << [words, block] end |
#branch_out(words, &block) ⇒ Object
920 921 922 |
# File 'lib/liza/helper_units/test.rb', line 920 def branch_out words, &block self.class.new self, before_stack.dup, after_stack.dup end |
#initialize_filters(before_stack, after_stack) ⇒ Object
899 900 901 902 903 |
# File 'lib/liza/helper_units/test.rb', line 899 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
893 894 895 896 897 |
# File 'lib/liza/helper_units/test.rb', line 893 def initialize_parenting parent @parent = parent || self @children = [] @parent.children << self if @parent != self end |
#log_test_building? ⇒ Boolean
881 882 883 |
# File 'lib/liza/helper_units/test.rb', line 881 def log_test_building? Liza::Test.log_test_building? end |