Module: Eaco::Coverage

Extended by:
Coverage
Included in:
Coverage
Defined in:
lib/eaco/coverage.rb

Overview

Integration with code coverage tools.

Loading this module will start collecting coverage data.

Instance Method Summary collapse

Instance Method Details

#format!String

Formats coverage results using the default formatter.

Returns:

  • (String)

    Coverage summary


43
44
45
46
47
# File 'lib/eaco/coverage.rb', line 43

def format!
  Rake::Utils.capture_stdout do
    result && result.format!
  end.strip
end

#report!nil

Reports coverage data to the remote service

Returns:

  • (nil)

31
32
33
34
35
36
# File 'lib/eaco/coverage.rb', line 31

def report!
  simplecov
  Coveralls.push!

  nil
end

#resultSimpleCov::Result (private)

The coverage result

Returns:

  • (SimpleCov::Result)

56
57
58
# File 'lib/eaco/coverage.rb', line 56

def result
  simplecov.result
end

#simplecovClass (private)

Configures simplecov using #simplecov_configuration

Returns:

  • (Class)

    SimpleCov


65
66
67
# File 'lib/eaco/coverage.rb', line 65

def simplecov
  SimpleCov.configure(&simplecov_configuration)
end

#simplecov_configurationProc (private)

Configures SimpleCov to use a different directory for each different appraisal Gemfile.

Returns:

  • (Proc)

    a SimpleCov configuration block.


75
76
77
78
79
80
# File 'lib/eaco/coverage.rb', line 75

def simplecov_configuration
  proc do
    gemfile = Eaco::Rake::Utils.gemfile
    coverage_dir "coverage/#{gemfile}"
  end
end

#start!nil

Starts collecting coverage data.

Returns:

  • (nil)

20
21
22
23
24
# File 'lib/eaco/coverage.rb', line 20

def start!
  Coveralls.wear_merged!(&simplecov_configuration)

  nil
end