Sha256: bc51887debd0a85cae8238203999480cdf42bfb0d61b01c2009dbdf61b7ca247

Contents?: true

Size: 980 Bytes

Versions: 4

Compression:

Stored size: 980 Bytes

Contents

module CukeModeler

  # A class modeling a Cucumber feature's Background.

  class Background < TestElement

    # Creates a new Background object and, if *source* is provided, populates
    # the object.
    def initialize(source = nil)
      parsed_background = process_source(source, 'cuke_modeler_stand_alone_background.feature')

      super(parsed_background)

      build_background(parsed_background) if parsed_background
    end

    # Returns gherkin representation of the background.
    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


    def build_background(parsed_background)
      # Just a stub in case something specific needs to be done
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cuke_modeler-0.4.1 lib/cuke_modeler/background.rb
cuke_modeler-0.4.0 lib/cuke_modeler/background.rb
cuke_modeler-0.3.0 lib/cuke_modeler/background.rb
cuke_modeler-0.2.0 lib/cuke_modeler/background.rb