Skip to content
This repository has been archived by the owner on Jan 4, 2021. It is now read-only.

Commit

Permalink
Extract coverage loader, on by default and use new formatters assign
Browse files Browse the repository at this point in the history
  • Loading branch information
mnoack committed Feb 3, 2016
1 parent 66716f3 commit 1a8576d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 26 deletions.
27 changes: 1 addition & 26 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,30 +1,5 @@
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)

MINIMUM_COVERAGE = 93

if ENV['COVERAGE']
require 'simplecov'
require 'simplecov-rcov'
require 'coveralls'
Coveralls.wear!

SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::RcovFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start do
add_filter '/vendor/'
add_filter '/spec/'
add_group 'lib', 'lib'
end
SimpleCov.at_exit do
SimpleCov.result.format!
percent = SimpleCov.result.covered_percent
unless percent >= MINIMUM_COVERAGE
puts "Coverage must be above #{MINIMUM_COVERAGE}%. It is #{format('%.2f', percent)}%"
Kernel.exit(1)
end
end
end
require 'support/coverage_loader'

require 'lagomorph'
26 changes: 26 additions & 0 deletions spec/support/coverage_loader.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
MINIMUM_COVERAGE = 93

unless ENV['COVERAGE'] == 'off'
require 'simplecov'
require 'simplecov-rcov'
require 'coveralls'
Coveralls.wear!

SimpleCov.formatters = [
SimpleCov::Formatter::RcovFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start do
add_filter '/vendor/'
add_filter '/spec/'
add_group 'lib', 'lib'
end
SimpleCov.at_exit do
SimpleCov.result.format!
percent = SimpleCov.result.covered_percent
unless percent >= MINIMUM_COVERAGE
puts "Coverage must be above #{MINIMUM_COVERAGE}%. It is #{format('%.2f', percent)}%"
Kernel.exit(1)
end
end
end

0 comments on commit 1a8576d

Please sign in to comment.