Sha256: 145552a78cb72707553663f27a8fe8cdea3de085e17e219a312992e83a9f08df

Contents?: true

Size: 591 Bytes

Versions: 14

Compression:

Stored size: 591 Bytes

Contents

# This is a complete replacement for the builtin Coverage module of Ruby

require 'coverage'
BuiltinCoverage = Coverage
Object.send(:remove_const, 'Coverage')

module Coverage
  def self.start
    @started = true
    DeepCover.start
    DeepCover.coverage.reset
  end

  def self.result
    raise 'coverage measurement is not enabled' unless @started
    @started = false
    self.peek
  end

  def self.peek
    results = DeepCover.coverage.covered_codes.map do |filename, covered_code|
      [filename, covered_code.line_coverage(allow_partial: false)]
    end
    Hash[results]
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
deep-cover-0.1.14 lib/deep_cover/core_ext/coverage_replacement.rb
deep-cover-0.1.13 lib/deep_cover/core_ext/coverage_replacement.rb
deep-cover-0.1.12 lib/deep_cover/core_ext/coverage_replacement.rb
deep-cover-0.1.11 lib/deep_cover/core_ext/coverage_replacement.rb
deep-cover-0.1.10 lib/deep_cover/core_ext/coverage_replacement.rb
deep-cover-0.1.9 lib/deep_cover/core_ext/coverage_replacement.rb
deep-cover-0.1.8 lib/deep_cover/core_ext/coverage_replacement.rb
deep-cover-0.1.7 lib/deep_cover/core_ext/coverage_replacement.rb
deep-cover-0.1.6 lib/deep_cover/core_ext/coverage_replacement.rb
deep-cover-0.1.5 lib/deep_cover/core_ext/coverage_replacement.rb
deep-cover-0.1.4 lib/deep_cover/core_ext/coverage_replacement.rb
deep-cover-0.1.3 lib/deep_cover/core_ext/coverage_replacement.rb
deep-cover-0.1.2 lib/deep_cover/core_ext/coverage_replacement.rb
deep-cover-0.1.1 lib/deep_cover/core_ext/coverage_replacement.rb