Class: RRRSpec::Cucumber::CucumberRunner
- Inherits:
-
Object
- Object
- RRRSpec::Cucumber::CucumberRunner
- Defined in:
- lib/rrrspec/cucumber/cucumber_runner.rb
Instance Method Summary collapse
- #process_result(formatter, result) ⇒ Object
- #reset ⇒ Object
- #run(*formatters) ⇒ Object
- #setup(file_path) ⇒ Object
Instance Method Details
#process_result(formatter, result) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/rrrspec/cucumber/cucumber_runner.rb', line 36 def process_result(formatter, result) penultimate_idx = result.lines.count - 2 penultimate_line = result.lines[penultimate_idx] if penultimate_line.match(/(\d+) failed/) n = penultimate_line.match(/(\d+) failed/)[1].to_i (1..n).each { formatter.example_failed nil } end if penultimate_line.match(/(\d+) skipped/) n = penultimate_line.match(/(\d+) skipped/)[1].to_i (1..n).each { formatter.example_pending nil} end if penultimate_line.match(/(\d+) passed/) n = penultimate_line.match(/(\d+) passed/)[1].to_i (1..n).each { formatter.example_passed nil} end end |
#reset ⇒ Object
32 33 34 |
# File 'lib/rrrspec/cucumber/cucumber_runner.rb', line 32 def reset @file_path = '' end |
#run(*formatters) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# 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. end [status, result_out, result_err] end |
#setup(file_path) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/rrrspec/cucumber/cucumber_runner.rb', line 5 def setup(file_path) @file_path = file_path status = true [status, '', ''] end |