Skip to content

Commit

Permalink
Use the latest Coverage Helper
Browse files Browse the repository at this point in the history
  • Loading branch information
lowjoel committed Jan 30, 2017
1 parent 009f418 commit efc2b36
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions spec/coverage_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# Simultaneous code coverage reporting to Coveralls and Code Climate.
# Latest version can be found at https://gist.github.com/lowjoel/6c2f2d3a08bb3786994f
require 'simplecov'
Expand All @@ -8,19 +9,16 @@ class << self
# gem.
#
# @param [String] name The name of the module to require.
# @param [Proc] initializer The block to execute when the module is required successfully.
def load(name, &initializer)
# @yield The block to execute when the module is required successfully.
def load(name)
old_formatter = SimpleCov.formatter
require name
initializer.call
yield

merge_formatters(old_formatter, SimpleCov.formatter)
rescue LoadError => e
if e.path == name
puts format('Cannot find \'%s\', ignoring', name) if ENV['CI']
else
raise e
end
raise e unless e.path == name
puts format('Cannot find \'%s\', ignoring', name) if ENV['CI']
end

private
Expand Down

0 comments on commit efc2b36

Please sign in to comment.