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



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

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] = File.basename(feature_file)}
  end

  scenarios.flatten
end