Class: Scrab::FeatureParser

Inherits:
Object
  • Object
show all
Defined in:
lib/scrab/feature_parser.rb

Defined Under Namespace

Classes: GherkinFormatter, ParsingError

Instance Method Summary collapse

Constructor Details

#initialize(story_klass) ⇒ FeatureParser

TODO: Pass story instance to parse instead of the class here



57
58
59
# File 'lib/scrab/feature_parser.rb', line 57

def initialize(story_klass)
  @story_klass = story_klass
end

Instance Method Details

#parse(feature_path) ⇒ Object



61
62
63
64
65
66
# File 'lib/scrab/feature_parser.rb', line 61

def parse(feature_path)
  story  = @story_klass.new
  parser = Gherkin::Parser::Parser.new(GherkinFormatter.new(story))
  parser.parse(File.read(feature_path), nil, 0)
  story
end