Sha256: 3b199f748af9b5b75518a0bf8c355e31e8ff6f5d10d9967a04a1080c8a042208

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

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, 'cuke_modeler_stand_alone_scenario.feature')

      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

4 entries across 4 versions & 1 rubygems

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