Module: RSpec::Support::Coverage

Defined in:
lib/hanami/devtools/integration/coverage.rb

Overview

Code coverage support

Since:

  • 0.2.0

Class Method Summary collapse

Class Method Details

.ci?Boolean

Returns:

  • (Boolean)

Since:

  • 0.2.0



26
27
28
# File 'lib/hanami/devtools/integration/coverage.rb', line 26

def self.ci?
  !ENV["TRAVIS"].nil?
end

.configure!Object

Since:

  • 0.2.0



9
10
11
12
13
14
15
16
# File 'lib/hanami/devtools/integration/coverage.rb', line 9

def self.configure!
  return unless enabled?

  require "simplecov"
  require "coveralls"

  configure_simplecov!
end

.configure_simplecov!Object

Since:

  • 0.2.0



35
36
37
38
39
40
41
42
43
44
# File 'lib/hanami/devtools/integration/coverage.rb', line 35

def self.configure_simplecov!
  SimpleCov.formatter = Coveralls::SimpleCov::Formatter if ci?

  SimpleCov.start do
    add_filter "spec/"
    add_filter "script/"
    add_filter "tmp/"
    add_filter "vendor/"
  end
end

.cover_as!(suite_name) ⇒ Object

Since:

  • 0.2.0



18
19
20
21
22
# File 'lib/hanami/devtools/integration/coverage.rb', line 18

def self.cover_as!(suite_name)
  return unless enabled?

  SimpleCov.command_name(suite_name)
end

.enabled?Boolean

Returns:

  • (Boolean)

Since:

  • 0.2.0



30
31
32
33
# File 'lib/hanami/devtools/integration/coverage.rb', line 30

def self.enabled?
  # !ENV['COVERAGE'].nil?
  false
end