class CucumberAnalytics::Background

A class modeling a Cucumber feature's Background.

Public Class Methods

new(source = nil) click to toggle source

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

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

Public Instance Methods

to_s() click to toggle source

Returns gherkin representation of the background.

# 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

Private Instance Methods

build_background(parsed_background) click to toggle source
# File lib/cucumber_analytics/background.rb, line 33
def build_background(parsed_background)
  # Just a stub in case something specific needs to be done
end