Class: ParallelTests::RSpec::Runner
- Inherits:
-
Test::Runner
- Object
- Test::Runner
- ParallelTests::RSpec::Runner
- Defined in:
- lib/parallel_tests/rspec/runner.rb
Class Method Summary collapse
- .build_test_command(file_list, options) ⇒ Object
-
.command_with_seed(cmd, seed) ⇒ Object
remove old seed and add new seed --seed 1234 --order rand --order rand:1234 --order random:1234.
- .default_test_folder ⇒ Object
- .determine_executable ⇒ Object
- .line_is_result?(line) ⇒ Boolean
- .run_tests(test_files, process_number, num_processes, options) ⇒ Object
- .runtime_log ⇒ Object
-
.summarize_results(results) ⇒ Object
Summarize results from threads and colorize results based on failure and pending counts.
- .test_file_name ⇒ Object
-
.test_suffix ⇒ Object
used to find all _spec.rb files supports also feature files used by rspec turnip extension.
Class Method Details
.build_test_command(file_list, options) ⇒ Object
44 45 46 |
# File 'lib/parallel_tests/rspec/runner.rb', line 44 def build_test_command(file_list, ) [*executable, *[:test_options], *color, *spec_opts, *file_list] end |
.command_with_seed(cmd, seed) ⇒ Object
remove old seed and add new seed --seed 1234 --order rand --order rand:1234 --order random:1234
53 54 55 56 |
# File 'lib/parallel_tests/rspec/runner.rb', line 53 def command_with_seed(cmd, seed) clean = remove_command_arguments(cmd, '--seed', '--order') [*clean, '--seed', seed] end |
.default_test_folder ⇒ Object
26 27 28 |
# File 'lib/parallel_tests/rspec/runner.rb', line 26 def default_test_folder "spec" end |
.determine_executable ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/parallel_tests/rspec/runner.rb', line 12 def determine_executable if File.exist?("bin/rspec") ParallelTests.with_ruby_binary("bin/rspec") elsif ParallelTests.bundler_enabled? ["bundle", "exec", "rspec"] else ["rspec"] end end |
.line_is_result?(line) ⇒ Boolean
40 41 42 |
# File 'lib/parallel_tests/rspec/runner.rb', line 40 def line_is_result?(line) line =~ /\d+ examples?, \d+ failures?/ end |
.run_tests(test_files, process_number, num_processes, options) ⇒ Object
8 9 10 |
# File 'lib/parallel_tests/rspec/runner.rb', line 8 def run_tests(test_files, process_number, num_processes, ) execute_command(build_command(test_files, ), process_number, num_processes, ) end |
.runtime_log ⇒ Object
22 23 24 |
# File 'lib/parallel_tests/rspec/runner.rb', line 22 def runtime_log "tmp/parallel_runtime_rspec.log" end |
.summarize_results(results) ⇒ Object
Summarize results from threads and colorize results based on failure and pending counts.
60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/parallel_tests/rspec/runner.rb', line 60 def summarize_results(results) text = super return text unless $stdout.tty? sums = sum_up_results(results) color = if sums['failure'] > 0 31 # red elsif sums['pending'] > 0 33 # yellow else 32 # green end "\e[#{color}m#{text}\e[0m" end |
.test_file_name ⇒ Object
30 31 32 |
# File 'lib/parallel_tests/rspec/runner.rb', line 30 def test_file_name "spec" end |
.test_suffix ⇒ Object
used to find all _spec.rb files supports also feature files used by rspec turnip extension
36 37 38 |
# File 'lib/parallel_tests/rspec/runner.rb', line 36 def test_suffix /(_spec\.rb|\.feature)$/ end |