Class: RRRSpec::RSpec::RSpecRunner
- Inherits:
-
Object
- Object
- RRRSpec::RSpec::RSpecRunner
- Defined in:
- lib/rrrspec/rspec/rspec_runner.rb
Instance Method Summary collapse
- #get_step_result_line(rspec_output) ⇒ Object
- #process_result(formatter, result) ⇒ Object
- #reset ⇒ Object
- #run(*formatters) ⇒ Object
- #setup(file_path) ⇒ Object
Instance Method Details
#get_step_result_line(rspec_output) ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'lib/rrrspec/rspec/rspec_runner.rb', line 56 def get_step_result_line(rspec_output) rspec_output.lines.each_with_index do |line, line_number| if /(\d*) examples?, (\d*) failures?/ =~ line return line_number end end -1 end |
#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/rspec/rspec_runner.rb', line 36 def process_result(formatter, result) results_line = result.lines[get_step_result_line(result)] failing_steps_count = failing_steps_count(results_line) pending_steps_count = pending_steps_count(results_line) total_steps_count = total_steps_count(results_line) (failing_steps_count + pending_steps_count).times do formatter.example_failed nil end (total_steps_count - failing_steps_count - pending_steps_count).times do formatter.example_passed nil end pending_steps_count.times do formatter.example_pending nil end end |
#reset ⇒ Object
32 33 34 |
# File 'lib/rrrspec/rspec/rspec_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/rspec/rspec_runner.rb', line 12 def run(*formatters) status = false result_err = '' begin result_out = `SLAVE_NUMBER=#{ENV['SLAVE_NUMBER']} bundle exec rspec #{@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/rspec/rspec_runner.rb', line 5 def setup(file_path) @file_path = file_path status = true [status, '', ''] end |