Sha256: 90da9b987214710ba312a0c9e5e5fea9c9b3168346cf68d8796161872848a138

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

# File: file-parsing.rb

require_relative '../../lib/cukedep/gherkin-facade'

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'
    ].freeze

    # Helper method. It parses sample feature files and
    # notifies the provided listener of its progress.
    def parse_for(aListener)
      orig_dir = Dir.getwd
      begin
        # Determine the folder where the sample files reside
        my_dir = File.dirname(__FILE__)
        sample_dir = File.expand_path(my_dir + '/sample_features')
        Dir.chdir(sample_dir)

        # Parse the specified feature files in work directory
        is_verbose = false
        gherkin_facade = GherkinFacade.new(is_verbose, 'UTF-8')
        gherkin_facade.parse_features(aListener, SampleFileNames)
      ensure
        Dir.chdir(orig_dir)
      end
    end
  end # module
end # module
# End of file

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cukedep-0.2.01 spec/cukedep/file-parsing.rb
cukedep-0.2.00 spec/cukedep/file-parsing.rb