Class: CucumberAnalytics::Background
- Inherits:
-
TestElement
- Object
- FeatureElement
- TestElement
- CucumberAnalytics::Background
- Defined in:
- lib/cucumber_analytics/background.rb
Overview
A class modeling a Cucumber feature’s Background.
Instance Attribute Summary
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) ⇒ Background
constructor
Creates a new Background object and, if source is provided, populates the object.
-
#to_s ⇒ Object
Returns gherkin representation of the background.
Methods inherited from TestElement
Methods included from Nested
Constructor Details
#initialize(source = nil) ⇒ Background
Creates a new Background object and, if source is provided, populates the object.
9 10 11 12 13 14 15 |
# File 'lib/cucumber_analytics/background.rb', line 9 def initialize(source = nil) parsed_background = process_source(source) super(parsed_background) build_background(parsed_background) if parsed_background end |
Instance Method Details
#to_s ⇒ Object
Returns gherkin representation of the background.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/cucumber_analytics/background.rb', line 18 def to_s text = '' text << "Background:#{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 |