Better Rubymine compatibility for .simplecov

Rubymine's code coverage tools separate collection from reporting so
that multiple runs can have their data merged.  To separate, collecting
from reporting, SimpleCov.start is only run when not using Rubymine (as
indicated by a lack of the RM_INFO environment variable).  This way,
`rake spec` will collect coverage info and generate the report as
before, but Rubymine will only collect coverage when using 'Run ... with
coverage enabled' button and will only generate a report when using
'Generate Coverage Report' as is the intended behavior in Rubymine.
This commit is contained in:
Luke Imhoff
2013-01-18 11:12:16 -06:00
parent e2ed4f25eb
commit 3c2c808457
2 changed files with 8 additions and 6 deletions
+8
View File
@@ -1,3 +1,11 @@
# RM_INFO is set when using Rubymine. In Rubymine, starting SimpleCov is
# controlled by running with coverage, so don't explicitly start coverage (and
# therefore generate a report) when in Rubymine. This _will_ generate a report
# whenever `rake spec` is run.
unless ENV['RM_INFO']
SimpleCov.start
end
SimpleCov.configure do
# ignore this file
add_filter '.simplecov'
-6
View File
@@ -11,12 +11,6 @@ $LOAD_PATH.unshift(lib_pathname.to_s)
# must be first require and started before any other requires so that it can measure coverage of all following required
# code. It is after the rubygems and bundler only because Bundler.setup supplies the LOAD_PATH to simplecov.
require 'simplecov'
# Ensure the coverage directory is always the same no matter where the individual spec is in the hierarchy when using
# Rubymine to run one spec.
#
# @see https://github.com/colszowka/simplecov/issues/95
SimpleCov.root(root_pathname)
SimpleCov.start
require 'rspec/core'