Class: ParallelTests::Turnip::Runner
- Inherits:
-
RSpec::Runner
- Object
- RSpec::Runner
- ParallelTests::Turnip::Runner
- Defined in:
- lib/parallel_tests/turnip/runner.rb
Constant Summary collapse
- NAME =
'Turnip'
Class Method Summary collapse
-
.find_features_and_specs(tests, options = {}) ⇒ Array
Two array of feature and spec filename.
- .test_file_name ⇒ Object
-
.tests_in_groups(tests, num_groups, options = {}) ⇒ Array
Test filenames that are grouped.
Class Method Details
.find_features_and_specs(tests, options = {}) ⇒ Array
Returns two array of feature and spec filename.
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/parallel_tests/turnip/runner.rb', line 40 def find_features_and_specs(tests, = {}) files = (tests || []).map do |file_or_folder| if File.directory?(file_or_folder) files = files_in_folder(file_or_folder, ) files.grep(/(\.feature|_spec\.rb)$/).grep([:pattern]||//) else file_or_folder end end.flatten.uniq files.partition { |file| file =~ /\.feature$/ } end |
.test_file_name ⇒ Object
10 11 12 |
# File 'lib/parallel_tests/turnip/runner.rb', line 10 def test_file_name 'turnip' end |
.tests_in_groups(tests, num_groups, options = {}) ⇒ Array
Note:
Conditions of the grouping:
feature: number of turnip steps.
spec: filesize.
Returns Test filenames that are grouped.
26 27 28 29 30 31 32 |
# File 'lib/parallel_tests/turnip/runner.rb', line 26 def tests_in_groups(tests, num_groups, ={}) features, specs = find_features_and_specs(tests, ) ftests = ::ParallelTests::Grouper.by_steps(features, num_groups, ) stests = ::ParallelTests::Grouper.in_even_groups_by_size(with_runtime_info(specs), num_groups, ) ftests.zip(stests).map { |t| t.flatten } end |