Class: Sapphire::DSL::Scenarios::Scenario
- Inherits:
-
Object
- Object
- Sapphire::DSL::Scenarios::Scenario
- Includes:
- Testing::RSpecRunner
- Defined in:
- lib/sapphire/DSL/Scenarios/scenario.rb
Instance Attribute Summary collapse
-
#backgrounds ⇒ Object
readonly
Returns the value of attribute backgrounds.
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#givens ⇒ Object
readonly
Returns the value of attribute givens.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #add_background(background) ⇒ Object
- #add_given(given) ⇒ Object
-
#initialize(text, &block) ⇒ Scenario
constructor
A new instance of Scenario.
- #last_background ⇒ Object
- #last_given ⇒ Object
Methods included from Testing::RSpecRunner
Constructor Details
#initialize(text, &block) ⇒ Scenario
Returns a new instance of Scenario.
14 15 16 17 18 19 20 21 |
# File 'lib/sapphire/DSL/Scenarios/scenario.rb', line 14 def initialize(text, &block) @value = text @text = text.to_s @block = block @givens = [] @backgrounds = [] @result = Testing::ScenarioResult.new(text) end |
Instance Attribute Details
#backgrounds ⇒ Object (readonly)
Returns the value of attribute backgrounds.
11 12 13 |
# File 'lib/sapphire/DSL/Scenarios/scenario.rb', line 11 def backgrounds @backgrounds end |
#block ⇒ Object (readonly)
Returns the value of attribute block.
7 8 9 |
# File 'lib/sapphire/DSL/Scenarios/scenario.rb', line 7 def block @block end |
#givens ⇒ Object (readonly)
Returns the value of attribute givens.
10 11 12 |
# File 'lib/sapphire/DSL/Scenarios/scenario.rb', line 10 def givens @givens end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
12 13 14 |
# File 'lib/sapphire/DSL/Scenarios/scenario.rb', line 12 def result @result end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
9 10 11 |
# File 'lib/sapphire/DSL/Scenarios/scenario.rb', line 9 def text @text end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
8 9 10 |
# File 'lib/sapphire/DSL/Scenarios/scenario.rb', line 8 def value @value end |
Instance Method Details
#add_background(background) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/sapphire/DSL/Scenarios/scenario.rb', line 35 def add_background(background) if(self.value.is_a? Pending) @backgrounds << Background.new(self, "", Pending.new(background.text), &block) else @backgrounds << background end end |
#add_given(given) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/sapphire/DSL/Scenarios/scenario.rb', line 23 def add_given(given) if(self.value.is_a? Pending) @givens << Given.new(self, "", Pending.new(given.text), &block) else @givens << given end end |
#last_background ⇒ Object
43 44 45 |
# File 'lib/sapphire/DSL/Scenarios/scenario.rb', line 43 def last_background @backgrounds.last end |
#last_given ⇒ Object
31 32 33 |
# File 'lib/sapphire/DSL/Scenarios/scenario.rb', line 31 def last_given @givens.last end |