Sha256: b1ce804835e2e807f9cd2602706c4e5ad1e5c4135105adc4b8f17976e8f86d7c

Contents?: true

Size: 846 Bytes

Versions: 1

Compression:

Stored size: 846 Bytes

Contents

module CucumberAnalytics
  class ParsedScenario < TestElement


    attr_accessor :tags


    # Creates a new ParsedScenario object and, if *source_lines* is provided,
    # populates the object.
    def initialize(source_lines = nil)
      super

      @tags = []

      parse_scenario(source_lines) if source_lines
    end


    private


    def parse_scenario(source_lines)
      parse_feature_element_tags(source_lines)
      parse_feature_element(source_lines)
      parse_test_element_steps(source_lines)
    end

    def parse_feature_element_description(source_lines)
      until source_lines.first =~ /^\s*(?:(?:Given )|(?:When )|(?:Then )|(?:And )|(?:\* ))/ or
          source_lines.empty?

        @description << source_lines.first.strip
        source_lines.shift
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cucumber_analytics-0.0.2 lib/cucumber_analytics/parsed_scenario.rb