Sha256: d6c2fce1ad94882ea931ce016ff1ed5f75b82116bccc6b9352524a0ffebe8e3e
Contents?: true
Size: 1.14 KB
Versions: 6
Compression:
Stored size: 1.14 KB
Contents
# File: file-parsing.rb require 'gherkin/parser/parser' module Cukedep # This module is used as a namespace # Mixin module used in tests. # Purpose: to parse a sample of feature files. module FileParsing # The list of sample feature file names. SampleFileNames = [ "a_few_tests.feature", "some_tests.feature", "still_other_tests.feature", "yet_other_tests.feature", "more_tests.feature", "standalone.feature" ] # Helper method. It parses sample feature files and # notifies the provided listener of its progress. def parse_for(aListener) # Determine the folder where the sample files reside my_dir = File.dirname(__FILE__) sample_dir = File.expand_path(my_dir + '/sample_features') # Create a Gherkin parser parser = Gherkin::Parser::Parser.new(aListener) # Let it parse the requested files SampleFileNames.each do |sample| path = sample_dir + '/' + sample File::open(path, 'r') { |f| parser.parse(f.read, path, 0) } end end end # module end # module # End of file
Version data entries
6 entries across 6 versions & 1 rubygems