Sha256: fa9615412d1119bb6c838580824a37e8bcb452c0946605bc0b508c05518accc2

Contents?: true

Size: 1.56 KB

Versions: 3

Compression:

Stored size: 1.56 KB

Contents

module CucumberAnalytics
  class OutlineExample < FeatureElement


    attr_accessor :tags
    attr_accessor :rows


    # Creates a new OutlineExample object and, if *source_lines* is provided,
    # populates the object.
    def initialize(source_lines = nil)
      CucumberAnalytics::Logging.logger.info('OutlineExample#initialize')
      CucumberAnalytics::Logging.logger.debug('source lines')
      source_lines.each do |line|
        CucumberAnalytics::Logging.logger.debug(line.chomp)
      end

      super

      @tags = []
      @rows = []

      parse_example(source_lines) if source_lines
    end


    private


    def parse_example(source_lines)
      CucumberAnalytics::Logging.logger.info('OutlineExample#parse_example')

      parse_feature_element_tags(source_lines)
      parse_feature_element(source_lines)

      source_lines.delete_if { |line| World.ignored_line?(line)}
      rows.concat source_lines.collect { |line| line.strip }
    end

    def parse_feature_element_description(source_lines)
      CucumberAnalytics::Logging.logger.info('OutlineExample#parse_feature_element_description')
      CucumberAnalytics::Logging.logger.debug('source lines')
      source_lines.each do |line|
        CucumberAnalytics::Logging.logger.debug(line.chomp)
      end

      until source_lines.first =~ /^\s*\|/ or
          source_lines.empty?

        unless World.ignored_line?(source_lines.first)
          @description << source_lines.first.strip
        end

        source_lines.shift
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cucumber_analytics-0.0.5 lib/cucumber_analytics/outline_example.rb
cucumber_analytics-0.0.4 lib/cucumber_analytics/outline_example.rb
cucumber_analytics-0.0.3 lib/cucumber_analytics/outline_example.rb