Sha256: f76c40dcccdbbd0ab39ac6aee4e5127fcc1dd3cfc22c1c63e5fb4849f483b1ca

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

module CucumberAnalytics

  # A class modeling a Cucumber Scenario Outline.

  class Outline < TestElement

    include Taggable


    # The Example objects contained by the Outline
    attr_accessor :examples


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

      super(parsed_outline)

      @tags = []
      @tag_elements = []
      @examples = []

      build_outline(parsed_outline) if parsed_outline
    end

    # Returns the immediate child elements of the outline (i.e. its Example
    # objects.
    def contains
      @examples + @steps
    end


    private


    def build_outline(parsed_outline)
      populate_element_tags(parsed_outline)
      populate_outline_examples(parsed_outline['examples']) if parsed_outline['examples']
    end

    def populate_outline_examples(parsed_examples)
      parsed_examples.each do |example|
        @examples << build_child_element(Example, example)
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cucumber_analytics-1.4.2 lib/cucumber_analytics/outline.rb
cucumber_analytics-1.4.1 lib/cucumber_analytics/outline.rb
cucumber_analytics-1.4.0 lib/cucumber_analytics/outline.rb
cucumber_analytics-1.3.0 lib/cucumber_analytics/outline.rb
cucumber_analytics-1.2.0 lib/cucumber_analytics/outline.rb