class RRRSpec::Cucumber::CucumberRunner
Public Instance Methods
get_step_result_line(result)
click to toggle source
# File lib/rrrspec/cucumber/cucumber_runner.rb, line 66 def get_step_result_line(result) i = 0; result.lines.each do |line| if line.include?('step (') || line.include?('steps (') return i end i += 1 end return -1 end
process_result(formatter, result)
click to toggle source
# File lib/rrrspec/cucumber/cucumber_runner.rb, line 36 def process_result(formatter, result) step_results_idx = get_step_result_line(result) step_results_line = result.lines[step_results_idx] if step_results_line.match(/(\d+) failed/) n = step_results_line.match(/(\d+) failed/)[1].to_i (1..n).each { formatter.example_failed nil } end if step_results_line.match(/(\d+) skipped/) n = step_results_line.match(/(\d+) skipped/)[1].to_i (1..n).each do formatter.example_failed nil formatter.example_pending nil end end if step_results_line.match(/(\d+) passed/) n = step_results_line.match(/(\d+) passed/)[1].to_i (1..n).each { formatter.example_passed nil} end if step_results_line.match(/(\d+) undefined/) n = step_results_line.match(/(\d+) undefined/)[1].to_i (1..n).each do formatter.example_failed nil end end end
reset()
click to toggle source
# File lib/rrrspec/cucumber/cucumber_runner.rb, line 32 def reset @file_path = '' end
run(*formatters)
click to toggle source
# File lib/rrrspec/cucumber/cucumber_runner.rb, line 12 def run(*formatters) status = false result_err = '' begin result_out = `SLAVE_NUMBER=#{ENV['SLAVE_NUMBER']} bundle exec cucumber #{@file_path}` formatters.each do |formatter_class| formatter = formatter_class.new nil process_result(formatter, result_out) end status = true rescue Exception => e result_err = e.message end [status, result_out, result_err] end
setup(file_path)
click to toggle source
# File lib/rrrspec/cucumber/cucumber_runner.rb, line 5 def setup(file_path) @file_path = file_path status = true [status, '', ''] end