Class: CukeIterations::CukeParser

Inherits:
Object
  • Object
show all
Defined in:
lib/cuke_iterations/cuke_parser.rb

Class Method Summary collapse

Class Method Details

.parse_features(dir) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/cuke_iterations/cuke_parser.rb', line 7

def parse_features(dir)
  scenarios = []
  Dir.glob(File.join(dir, '**/*.feature')).each do |feature_file|
    formatter = ScenarioExtractingFormatter.new
    parser = Gherkin::Parser::Parser.new (formatter)
    text = File.open(feature_file, 'r') { |f| f.read }
    parser.parse(text, __FILE__, __LINE__-1)

    scenarios << formatter.discovered_scenarios.each {|s| s[:filename] = relative_path(feature_file, dir)}
  end

  scenarios.flatten
end