Sha256: 4520115f660cd0e1d36bda2b6e81d8446e404941ed896768c2a82f38f4806a63

Contents?: true

Size: 997 Bytes

Versions: 3

Compression:

Stored size: 997 Bytes

Contents

module CukeModeler

  # A class modeling a Cucumber Scenario.

  class Scenario < TestElement

    include Taggable


    # Creates a new Scenario object and, if *source* is provided, populates the
    # object.
    def initialize(source = nil)
      parsed_scenario = process_source(source)

      super(parsed_scenario)

      @tags = []
      @tag_elements = []

      build_scenario(parsed_scenario) if parsed_scenario
    end

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


    def build_scenario(scenario)
      populate_element_tags(scenario)
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cuke_modeler-0.1.0 lib/cuke_modeler/scenario.rb
cuke_modeler-0.0.2 lib/cuke_modeler/scenario.rb
cuke_modeler-0.0.1 lib/cuke_modeler/scenario.rb