Class: SpecTracker::SpecParser::BaseParser

Inherits:
Object
  • Object
show all
Defined in:
lib/spec_tracker/spec_parser/base_parser.rb

Direct Known Subclasses

CSVParser, GherkinParser

Instance Method Summary collapse

Instance Method Details

#parse(path) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/spec_tracker/spec_parser/base_parser.rb', line 4

def parse(path)
  specifications = []
  if spec_path(path).directory?
    spec_path(path).each_entry do |entry|
      next unless entry.extname == spec_file_extension
      scenarios = parse_single(spec_path(path).join(entry.basename))
      specifications << Specification.new(topic: entry.basename, scenarios: scenarios)
    end
  else
    scenarios = parse_single(spec_path(path))
    specifications << Specification.new(topic: spec_path(path).basename, scenarios: scenarios)
  end
  specifications
end