class ParallelTests::RSpec::Runner
Constants
- DEV_NULL
- NAME
Public Class Methods
command_with_seed(cmd, seed)
click to toggle source
remove old seed and add new seed –seed 1234 –order rand –order rand:1234 –order random:1234
# File lib/parallel_tests/rspec/runner.rb, line 51 def command_with_seed(cmd, seed) clean = cmd.sub(/\s--(seed\s+\d+|order\s+rand(om)?(:\d+)?)\b/, '') "#{clean} --seed #{seed}" end
determine_executable()
click to toggle source
# File lib/parallel_tests/rspec/runner.rb, line 16 def determine_executable cmd = case when File.exist?("bin/rspec") ParallelTests.with_ruby_binary("bin/rspec") when ParallelTests.bundler_enabled? cmd = (run("bundle show rspec-core") =~ %r{Could not find gem.*} ? "spec" : "rspec") "bundle exec #{cmd}" else %w[spec rspec].detect{|cmd| system "#{cmd} --version > #{DEV_NULL} 2>&1" } end cmd or raise("Can't find executables rspec or spec") end
line_is_result?(line)
click to toggle source
# File lib/parallel_tests/rspec/runner.rb, line 42 def line_is_result?(line) line =~ /\d+ examples?, \d+ failures?/ end
run_tests(test_files, process_number, num_processes, options)
click to toggle source
# File lib/parallel_tests/rspec/runner.rb, line 10 def run_tests(test_files, process_number, num_processes, options) exe = executable # expensive, so we cache cmd = [exe, options[:test_options], color, spec_opts, *test_files].compact.join(" ") execute_command(cmd, process_number, num_processes, options) end
runtime_log()
click to toggle source
# File lib/parallel_tests/rspec/runner.rb, line 30 def runtime_log 'tmp/parallel_runtime_rspec.log' end
test_file_name()
click to toggle source
# File lib/parallel_tests/rspec/runner.rb, line 34 def test_file_name "spec" end
test_suffix()
click to toggle source
# File lib/parallel_tests/rspec/runner.rb, line 38 def test_suffix /_spec\.rb$/ end
Private Class Methods
color()
click to toggle source
# File lib/parallel_tests/rspec/runner.rb, line 64 def color '--color --tty' if $stdout.tty? end
run(cmd)
click to toggle source
so it can be stubbed.…
# File lib/parallel_tests/rspec/runner.rb, line 60 def run(cmd) `#{cmd}` end
spec_opts()
click to toggle source
# File lib/parallel_tests/rspec/runner.rb, line 68 def spec_opts options_file = ['.rspec_parallel', 'spec/parallel_spec.opts', 'spec/spec.opts'].detect{|f| File.file?(f) } return unless options_file "-O #{options_file}" end