Module: ForkingTestRunner::CoverageCapture
- Defined in:
- lib/forking_test_runner/coverage_capture.rb
Class Attribute Summary collapse
-
.coverage ⇒ Object
Returns the value of attribute coverage.
Class Method Summary collapse
Instance Method Summary collapse
-
#capture_coverage! ⇒ Object
deprecated, single_cov checks for this, so leave it here.
-
#result ⇒ Object
override Coverage.result to add pre-fork captured coverage.
Class Attribute Details
.coverage ⇒ Object
Returns the value of attribute coverage.
14 15 16 |
# File 'lib/forking_test_runner/coverage_capture.rb', line 14 def coverage @coverage end |
Class Method Details
.activate! ⇒ Object
16 17 18 19 |
# File 'lib/forking_test_runner/coverage_capture.rb', line 16 def activate! require 'coverage' (class << Coverage; self; end).prepend self end |
.capture! ⇒ Object
21 22 23 |
# File 'lib/forking_test_runner/coverage_capture.rb', line 21 def capture! self.coverage = Coverage.peek_result.dup end |
.merge_coverage(a, b) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/forking_test_runner/coverage_capture.rb', line 25 def merge_coverage(a, b) merged = a.dup b.each do |file, coverage| orig = merged[file] merged[file] = if orig if coverage.is_a?(Array) merge_lines_coverage(orig, coverage) else { lines: merge_lines_coverage(orig.fetch(:lines), coverage.fetch(:lines)), branches: merge_branches_coverage(orig.fetch(:branches), coverage.fetch(:branches)) } end else coverage end end merged end |
Instance Method Details
#capture_coverage! ⇒ Object
deprecated, single_cov checks for this, so leave it here
11 |
# File 'lib/forking_test_runner/coverage_capture.rb', line 11 def capture_coverage!; end |
#result ⇒ Object
override Coverage.result to add pre-fork captured coverage
5 6 7 8 |
# File 'lib/forking_test_runner/coverage_capture.rb', line 5 def result return super unless captured = CoverageCapture.coverage CoverageCapture.merge_coverage(super, captured) end |