Class: ParallelSpecs::RSpec::Runner

Inherits:
Test::Runner show all
Defined in:
lib/parallel_specs/rspec/runner.rb

Constant Summary

Constants inherited from Test::Runner

Test::Runner::RuntimeLogParseError, Test::Runner::RuntimeLogTooSmallError

Class Method Summary collapse

Methods inherited from Test::Runner

execute_command, execute_command_and_capture_output, find_results, print_command, tests_in_groups, tests_with_size

Class Method Details

.command_with_seed(command, seed) ⇒ Object



54
55
56
# File 'lib/parallel_specs/rspec/runner.rb', line 54

def command_with_seed(command, seed)
  [*remove_command_arguments(command, '--seed', '--order'), '--seed', seed]
end

.default_test_folderObject



22
23
24
# File 'lib/parallel_specs/rspec/runner.rb', line 22

def default_test_folder
  'spec'
end

.line_is_result?(line) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/parallel_specs/rspec/runner.rb', line 30

def line_is_result?(line)
  line =~ /\d+ examples?, \d+ failures?/
end

.rerun_command(command, seed: nil) ⇒ Object



49
50
51
52
# File 'lib/parallel_specs/rspec/runner.rb', line 49

def rerun_command(command, seed: nil)
  command = remove_rerun_only_formatters(command)
  seed ? command_with_seed(command, seed) : command
end

.run_tests(test_files, process_number, num_processes, options) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/parallel_specs/rspec/runner.rb', line 9

def run_tests(test_files, process_number, num_processes, options)
  execute_command(
    build_test_command(test_files, process_number, options),
    process_number,
    num_processes,
    options
  )
end

.runtime_logObject



18
19
20
# File 'lib/parallel_specs/rspec/runner.rb', line 18

def runtime_log
  'tmp/parallel_runtime_rspec.log'
end

.summarize_results(results) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/parallel_specs/rspec/runner.rb', line 34

def summarize_results(results)
  text = super
  return text unless $stdout.tty?

  sums = send(:sum_up_results, results)
  color_code = if sums['failure'] > 0
    31
  elsif sums['pending'] > 0
    33
  else
    32
  end
  "\e[#{color_code}m#{text}\e[0m"
end

.test_file_nameObject



26
27
28
# File 'lib/parallel_specs/rspec/runner.rb', line 26

def test_file_name
  'spec'
end