class SpecTracker::SpecParser::GherkinParser
Public Class Methods
new()
click to toggle source
# File lib/spec_tracker/spec_parser/gherkin_parser.rb, line 4 def initialize @language_parser = Gherkin::Parser.new end
Private Instance Methods
parse_single(spec_file)
click to toggle source
FIXME: handle large files
# File lib/spec_tracker/spec_parser/gherkin_parser.rb, line 15 def parse_single(spec_file) file_content = File.read(spec_file) parse_result = @language_parser.parse(file_content) parse_result[:feature][:children].select { |child| child[:type].downcase == :scenario }.map do |scenario| scenario_id = scenario[:name].slice(SpecTracker.configuration.scenario_id_regex, 1) next if scenario_id.nil? scenario_name = scenario[:name].gsub(SpecTracker.configuration.scenario_id_regex, '').strip Scenario.new(id: scenario_id, name: scenario_name) end end
spec_file_extension()
click to toggle source
# File lib/spec_tracker/spec_parser/gherkin_parser.rb, line 10 def spec_file_extension '.feature' end