Class: Finally

Inherits:
Object show all
Includes:
Sapphire::Testing::Executable
Defined in:
lib/sapphire/DSL/Scenarios/finally.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Sapphire::Testing::Executable

#Report, #execute, #pend

Constructor Details

#initialize(parent, text, &block) ⇒ Finally

Returns a new instance of Finally.



11
12
13
14
15
16
17
18
# File 'lib/sapphire/DSL/Scenarios/finally.rb', line 11

def initialize(parent, text, &block)
  @value = text
  @text = text.to_s
  @block = block
  @and = []
  @parent = parent
  @results = []
end

Instance Attribute Details

#andObject (readonly)

Returns the value of attribute and.



7
8
9
# File 'lib/sapphire/DSL/Scenarios/finally.rb', line 7

def and
  @and
end

#blockObject (readonly)

Returns the value of attribute block.



5
6
7
# File 'lib/sapphire/DSL/Scenarios/finally.rb', line 5

def block
  @block
end

#parentObject (readonly)

Returns the value of attribute parent.



8
9
10
# File 'lib/sapphire/DSL/Scenarios/finally.rb', line 8

def parent
  @parent
end

#resultsObject (readonly)

Returns the value of attribute results.



9
10
11
# File 'lib/sapphire/DSL/Scenarios/finally.rb', line 9

def results
  @results
end

#textObject (readonly)

Returns the value of attribute text.



6
7
8
# File 'lib/sapphire/DSL/Scenarios/finally.rb', line 6

def text
  @text
end

#valueObject (readonly)

Returns the value of attribute value.



4
5
6
# File 'lib/sapphire/DSL/Scenarios/finally.rb', line 4

def value
  @value
end

Instance Method Details

#add_and(pre, text, &block) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/sapphire/DSL/Scenarios/finally.rb', line 20

def add_and(pre, text, &block)
  if(self.value.is_a? Pending)
    self.and << And.new(self, Pending.new(pre + text), &block)
  elsif(self.value.is_a? Broken)
    self.and << And.new(self, Broken.new(pre + text), &block)
  else
    self.and << And.new(self, pre + text, &block)
  end
end

#AddResult(result) ⇒ Object



30
31
32
33
34
# File 'lib/sapphire/DSL/Scenarios/finally.rb', line 30

def AddResult(result)
  result.item = self
  @results << result
  self.parent.AddResult(result)
end