Class: Then
- Inherits:
-
Object
- Object
- Then
- Includes:
- Sapphire::Testing::Executable
- Defined in:
- lib/sapphire/DSL/Scenarios/then.rb
Instance Attribute Summary collapse
-
#and ⇒ Object
readonly
Returns the value of attribute and.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
-
#text ⇒ Object
Returns the value of attribute text.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #add_and(pre, text, &block) ⇒ Object
- #AddResult(result) ⇒ Object
-
#initialize(parent, pre, text, &block) ⇒ Then
constructor
A new instance of Then.
Methods included from Sapphire::Testing::Executable
Constructor Details
#initialize(parent, pre, text, &block) ⇒ Then
Returns a new instance of Then.
11 12 13 14 15 16 17 18 |
# File 'lib/sapphire/DSL/Scenarios/then.rb', line 11 def initialize(parent, pre, text, &block) @block = block @value = text @text = pre + text.to_s @and = [] @parent = parent @results = [] end |
Instance Attribute Details
#and ⇒ Object (readonly)
Returns the value of attribute and.
7 8 9 |
# File 'lib/sapphire/DSL/Scenarios/then.rb', line 7 def and @and end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
6 7 8 |
# File 'lib/sapphire/DSL/Scenarios/then.rb', line 6 def block @block end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
8 9 10 |
# File 'lib/sapphire/DSL/Scenarios/then.rb', line 8 def parent @parent end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
9 10 11 |
# File 'lib/sapphire/DSL/Scenarios/then.rb', line 9 def results @results end |
#text ⇒ Object
Returns the value of attribute text.
5 6 7 |
# File 'lib/sapphire/DSL/Scenarios/then.rb', line 5 def text @text end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/sapphire/DSL/Scenarios/then.rb', line 4 def value @value end |
Instance Method Details
#add_and(pre, text, &block) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/sapphire/DSL/Scenarios/then.rb', line 20 def add_and(pre, text, &block) if(!self.value.instance_of? Pending) x = Then.new(self, pre, text, &block) self.and << x else self.and << Then.new(self, pre, Pending.new(pre + text), &block) end end |
#AddResult(result) ⇒ Object
29 30 31 32 |
# File 'lib/sapphire/DSL/Scenarios/then.rb', line 29 def AddResult(result) @results << result self.parent.results.last.AddChild(result) end |