Class: ParallelTests::RSpec::Runner

Inherits:
Test::Runner
  • Object
show all
Defined in:
lib/chemistrykit/parallel_tests_mods.rb

Overview

Monkey Patching the ParallelTest RSpec Runner class to work with CKit’s config and binary

Class Method Summary collapse

Class Method Details

.determine_executableObject



35
36
37
# File 'lib/chemistrykit/parallel_tests_mods.rb', line 35

def determine_executable
  'bundle exec ckit brew --parallel'
end

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



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/chemistrykit/parallel_tests_mods.rb', line 13

def run_tests(test_files, process_number, num_processes, options)
  exe = executable # expensive, so we cache
  version = (exe =~ /\brspec\b/ ? 2 : 1)

# // Beginning of method modifications //
# cmd = [exe, options[:test_options], (rspec_2_color if version == 2), spec_opts, *test_files].compact.join(" ")
# NOTE: The above line was modified to conform to ckit's command line constraints

  cmd = [exe, options[:test_options]].compact.join(' ')
  cmd << test_files.join(' ')
  puts cmd

# This concatenates the command into `bundle exec ckit brew --beakers=beaker1 beaker2 beaker3 etc`
# Which enables each test group to be run in its own command
# --beakers= is set in lib/chemkistrykit/cli/cli.rb when parallel_tests is executed using its -o option flag

# // End of method modifications //

  options = options.merge(env: rspec_1_color) if version == 1
  execute_command(cmd, process_number, num_processes, options)
end

.runtime_logObject



47
48
49
50
# File 'lib/chemistrykit/parallel_tests_mods.rb', line 47

def runtime_log
  # TODO This needs to do something.
  File.join(Dir.getwd, 'evidence', 'parallel_runtime_rspec.log')
end

.test_file_nameObject



39
40
41
# File 'lib/chemistrykit/parallel_tests_mods.rb', line 39

def test_file_name
  'beaker'
end

.test_suffixObject



43
44
45
# File 'lib/chemistrykit/parallel_tests_mods.rb', line 43

def test_suffix
  '_beaker.rb'
end