Sha256: 20c4b51964bd6b4b1c31616a75d3c2fd9487b8c9d3c20b855afba2fc99e8f514
Contents?: true
Size: 2 KB
Versions: 1
Compression:
Stored size: 2 KB
Contents
require 'aipim-rails/parser_helper' module Parser def self.init(filename) parser(filename) end def self.read_line(file) line = file.gets line = line.gsub("\n", "").split(' ').join(' ') unless line.nil? line end def self.parser(filename) file = File.new("features/"+filename, "r") screenshots = %x[\ls aipim/screenshots/#{filename}].split("\n") is_screenshot = false; scenario_counter = 1; screenshot_counter = 0 feature = []; feature_name = nil; feature_description = [] context_name = nil; context_description = [] scenarios = []; scenario_name = nil; scenario_steps = []; screenshot = nil line = read_line(file) while (line) if ParserHelper.is_marcacao?(line) && ParserHelper.is_screenshot?(line) is_screenshot = true line = read_line(file) elsif ParserHelper.is_funcionalidade?(line) feature_name = ParserHelper.get_funcionalidade(line) while ((line = read_line(file)) && !ParserHelper.is_comando?(line)) feature_description << line if !(line.gsub(" ", "") == "") end elsif ParserHelper.is_contexto?(line) while ((line = read_line(file)) && !ParserHelper.is_comando?(line)) context_description << line if !(line.gsub(" ", "") == "") end elsif ParserHelper.is_cenario?(line) scenario_name = ParserHelper.get_cenario(line) while ((line = read_line(file)) && !ParserHelper.is_comando?(line)) scenario_steps << line if !(line.gsub(" ", "") == "") end if is_screenshot screenshot = screenshots[screenshot_counter].to_s screenshot_counter = screenshot_counter+1 is_screenshot = false end scenarios << {name: scenario_name, steps: scenario_steps, screenshot: screenshot} scenario_steps = [] screenshot = nil else line = read_line(file) end end file.close feature = { feature_name: feature_name, feature_description: feature_description, context_name: context_name, context_description: context_description, scenarios: scenarios, filename: filename } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aipim-rails-0.0.139 | lib/aipim-rails/parser.rb |