Skip to content

Commit

Permalink
Better configure code coverage
Browse files Browse the repository at this point in the history
Coverage is not working on CodeClimate or locally, at least in part
because it is incorrectly configured. Trying to fix this with the
following changes:

* require and start coverage before loading the real code
* filter out the test files from the coverage
  • Loading branch information
acant committed Jun 2, 2016
1 parent 3a147b8 commit c9f8c2c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions test/unit/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@
require 'rubygems'
require 'minitest/autorun'
$LOAD_PATH.unshift File.expand_path('../../lib')
require 'gitdocs'
require 'mocha/setup'
require 'shell_tools'

Dir.glob(File.expand_path('../../support/**/*.rb', __FILE__)).each do |filename|
require_relative filename
end

Gitdocs::Initializer.root_dirname = '/tmp/gitdocs'
Gitdocs::Initializer.database = ':memory:'

# Setup code coverage, first ###################################################
require 'codeclimate-test-reporter'
SimpleCov.add_filter 'test'
SimpleCov.start
CodeClimate::TestReporter.start

# Load and configure the real code #############################################
require 'gitdocs'

Gitdocs::Initializer.root_dirname = '/tmp/gitdocs'
Gitdocs::Initializer.database = ':memory:'

GitFactory.working_directory = File.expand_path('../../../tmp/unit', __FILE__)

0 comments on commit c9f8c2c

Please sign in to comment.