Class: CucumberAnalytics::Scenario
- Inherits:
-
TestElement
- Object
- FeatureElement
- TestElement
- CucumberAnalytics::Scenario
- Includes:
- Taggable
- Defined in:
- lib/cucumber_analytics/scenario.rb
Overview
A class modeling a Cucumber Scenario.
Instance Attribute Summary
Attributes included from Taggable
Attributes inherited from TestElement
Attributes inherited from FeatureElement
#description, #description_text, #name
Attributes included from Nested
Attributes included from Raw
Attributes included from Sourceable
Instance Method Summary collapse
-
#initialize(source = nil) ⇒ Scenario
constructor
Creates a new Scenario object and, if source is provided, populates the object.
-
#to_s ⇒ Object
Returns gherkin representation of the scenario.
Methods included from Taggable
#all_tag_elements, #all_tags, #applied_tag_elements, #applied_tags
Methods inherited from TestElement
Methods included from Nested
Constructor Details
#initialize(source = nil) ⇒ Scenario
Creates a new Scenario object and, if source is provided, populates the object.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/cucumber_analytics/scenario.rb', line 12 def initialize(source = nil) parsed_scenario = process_source(source) super(parsed_scenario) @tags = [] @tag_elements = [] build_scenario(parsed_scenario) if parsed_scenario end |
Instance Method Details
#to_s ⇒ Object
Returns gherkin representation of the scenario.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/cucumber_analytics/scenario.rb', line 24 def to_s text = '' text << tag_output_string + "\n" unless .empty? text << "Scenario:#{name_output_string}" text << "\n" + description_output_string unless description_text.empty? text << "\n" unless steps.empty? || description_text.empty? text << "\n" + steps_output_string unless steps.empty? text end |