Class: KnapsackPro::TestCaseMergers::RSpecMerger
- Inherits:
-
BaseMerger
- Object
- BaseMerger
- KnapsackPro::TestCaseMergers::RSpecMerger
- Defined in:
- lib/knapsack_pro/test_case_mergers/rspec_merger.rb
Constant Summary
Constants inherited from BaseMerger
BaseMerger::ADAPTER_TO_MERGER_MAP
Instance Method Summary collapse
Methods inherited from BaseMerger
Constructor Details
This class inherits a constructor from KnapsackPro::TestCaseMergers::BaseMerger
Instance Method Details
#call ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/knapsack_pro/test_case_mergers/rspec_merger.rb', line 6 def call all_test_files_hash = {} merged_test_file_examples_hash = {} test_files.each do |test_file| path = test_file.fetch('path') test_file_path = extract_test_file_path(path) if rspec_id_path?(path) merged_test_file_examples_hash[test_file_path] ||= 0.0 merged_test_file_examples_hash[test_file_path] += test_file.fetch('time_execution') else all_test_files_hash[test_file_path] = test_file.fetch('time_execution') end end merged_test_file_examples_hash.each do |path, time_execution| all_test_files_hash[path] = [time_execution, all_test_files_hash[path]].compact.max end merged_test_files = [] all_test_files_hash.each do |path, time_execution| merged_test_files << { 'path' => path, 'time_execution' => time_execution } end merged_test_files end |