Class: Sapphire::DSL::Scenarios::Scenario
- Includes:
- Testing::TestRunnerAdapter
- 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.
-
#file_name ⇒ Object
Returns the value of attribute file_name.
-
#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::TestRunnerAdapter
Constructor Details
#initialize(text, &block) ⇒ Scenario
Returns a new instance of Scenario.
15 16 17 18 19 20 21 22 23 |
# File 'lib/sapphire/DSL/Scenarios/scenario.rb', line 15 def initialize(text, &block) @value = text @text = text.to_s @block = block @givens = [] @backgrounds = [] @result = Testing::ScenarioResult.new(text) @file_name = "" 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 |
#file_name ⇒ Object
Returns the value of attribute file_name.
13 14 15 |
# File 'lib/sapphire/DSL/Scenarios/scenario.rb', line 13 def file_name @file_name 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
39 40 41 42 43 44 45 46 47 |
# File 'lib/sapphire/DSL/Scenarios/scenario.rb', line 39 def add_background(background) if(self.value.is_a? Pending) @backgrounds << Background.new(self, "", Pending.new(background.text), &block) elsif(self.value.is_a? Broken) @backgrounds << Background.new(self, "", Broken.new(background.text), &block) else @backgrounds << background end end |
#add_given(given) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/sapphire/DSL/Scenarios/scenario.rb', line 25 def add_given(given) if(self.value.is_a? Pending) @givens << Given.new(self, "", Pending.new(given.text), &block) elsif(self.value.is_a? Broken) @givens << Given.new(self, "", Broken.new(given.text), &block) else @givens << given end end |
#last_background ⇒ Object
49 50 51 |
# File 'lib/sapphire/DSL/Scenarios/scenario.rb', line 49 def last_background @backgrounds.last end |
#last_given ⇒ Object
35 36 37 |
# File 'lib/sapphire/DSL/Scenarios/scenario.rb', line 35 def last_given @givens.last end |