Class: TestMap::Report
- Inherits:
-
Object
- Object
- TestMap::Report
- Defined in:
- lib/test_map/report.rb
Overview
Report keeps track of associated files to test execution.
Instance Method Summary collapse
- #add(files) ⇒ Object
-
#initialize ⇒ Report
constructor
A new instance of Report.
- #merge(result, current) ⇒ Object
- #results ⇒ Object
- #to_yaml ⇒ Object
- #write(file) ⇒ Object
Constructor Details
#initialize ⇒ Report
Returns a new instance of Report.
8 |
# File 'lib/test_map/report.rb', line 8 def initialize = @results = Hash.new { Set.new } |
Instance Method Details
#add(files) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/test_map/report.rb', line 10 def add(files) test_file, *associated_files = files TestMap.logger.info "Adding #{test_file} with #{associated_files}" associated_files.each do |file| @results[file] = @results[file] << test_file end end |
#merge(result, current) ⇒ Object
30 31 32 33 34 |
# File 'lib/test_map/report.rb', line 30 def merge(result, current) current.merge(result) do |_key, oldval, newval| (oldval + newval).uniq.sort end end |
#results ⇒ Object
27 |
# File 'lib/test_map/report.rb', line 27 def results = @results.transform_values { _1.to_a.uniq.sort }.sort.to_h |
#to_yaml ⇒ Object
28 |
# File 'lib/test_map/report.rb', line 28 def to_yaml = results.to_yaml |