Sha256: fe7d6250591b362d50474a643eca6752492cc0397efdb30e2a4ae034a9eb1d33

Contents?: true

Size: 757 Bytes

Versions: 1

Compression:

Stored size: 757 Bytes

Contents

module CucumberAnalytics
  class ParsedBackground < TestElement


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

      parse_background(source_lines) if source_lines
    end


    private


    def parse_background(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_background.rb