Class: ScenarioContext::ScenarioProxy
- Inherits:
-
Struct
- Object
- Struct
- ScenarioContext::ScenarioProxy
- Defined in:
- lib/scenario_context/scenario_proxy.rb
Overview
A generic interface to a Scenario or ExampleRow
Instance Attribute Summary collapse
-
#scenario ⇒ Object
Returns the value of attribute scenario.
Instance Method Summary collapse
-
#file_colon_line ⇒ String
The file name colon line number representation of the scenario.
-
#outline ⇒ Boolean
Scenario.scenario_outline if the scenario is an outline.
-
#outline? ⇒ Boolean
Whether @scenario is an outline (ExampleRow) or a not.
-
#title ⇒ String
(also: #name)
if @scenario is an outline.
Instance Attribute Details
#scenario ⇒ Object
Returns the value of attribute scenario
5 6 7 |
# File 'lib/scenario_context/scenario_proxy.rb', line 5 def scenario @scenario end |
Instance Method Details
#file_colon_line ⇒ String
Returns the file name colon line number representation of the scenario.
8 9 10 11 12 13 14 |
# File 'lib/scenario_context/scenario_proxy.rb', line 8 def file_colon_line if outline? scenario.file_colon_line else scenario.scenario_outline.file_colon_line end end |
#outline ⇒ Boolean
Returns scenario.scenario_outline if the scenario is an outline.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/scenario_context/scenario_proxy.rb', line 18 def outline unless outline? fail( NotImplementedError, 'ScenarioContext#outline is only available for scenario outlines.' ) end scenario.scenario_outline end |
#outline? ⇒ Boolean
Returns whether @scenario is an outline (ExampleRow) or a not.
30 31 32 33 34 |
# File 'lib/scenario_context/scenario_proxy.rb', line 30 def outline? return unless defined?(Cucumber::Ast::OutlineTable::ExampleRow) scenario.is_a?(Cucumber::Ast::OutlineTable::ExampleRow) end |
#title ⇒ String Also known as: name
if @scenario is an outline
38 39 40 41 42 43 44 45 |
# File 'lib/scenario_context/scenario_proxy.rb', line 38 def title if outline? scenario_name = scenario.name.match(/\| (.*) \|/)[1] "#{outline.title}: #{scenario_name}" else scenario.title end end |