class CucumberAnalytics::Scenario

A class modeling a Cucumber Scenario.

Public Class Methods

new(source = nil) click to toggle source

Creates a new Scenario object and, if source is provided, populates the object.

Calls superclass method
# 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

Public Instance Methods

to_s() click to toggle source

Returns gherkin representation of the scenario.

# File lib/cucumber_analytics/scenario.rb, line 24
def to_s
  text = ''

  text << tag_output_string + "\n" unless tags.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

Private Instance Methods

build_scenario(scenario) click to toggle source
# File lib/cucumber_analytics/scenario.rb, line 40
def build_scenario(scenario)
  populate_element_tags(scenario)
end