Class: ParallelTests::RSpec::Runner

Inherits:
Test::Runner
  • Object
show all
Defined in:
lib/chemistrykit/parallel_tests/rspec/runner.rb

Overview

Monkey Patching the ParallelTest RSpec Runner class to work with CKit’s config and binary TODO: we could probably make this its own typed runner versus extinding the rspec one if this continues to get used

Class Method Summary collapse

Class Method Details

.determine_executableObject



36
37
38
# File 'lib/chemistrykit/parallel_tests/rspec/runner.rb', line 36

def determine_executable
  'bundle exec ckit brew'
end

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



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

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

  # Passes the process number into so that any generated assets can be identified.
  cmd = [exe, "--parallel=#{process_number}", options[:test_options]].compact.join(' ')
  cmd << test_files.join(' ')

# 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



48
49
50
51
# File 'lib/chemistrykit/parallel_tests/rspec/runner.rb', line 48

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

.test_file_nameObject



40
41
42
# File 'lib/chemistrykit/parallel_tests/rspec/runner.rb', line 40

def test_file_name
  'beaker'
end

.test_suffixObject



44
45
46
# File 'lib/chemistrykit/parallel_tests/rspec/runner.rb', line 44

def test_suffix
  '_beaker.rb'
end