Browse files

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.
  • Loading branch information...
1 parent e2ed4f2 commit 3c2c808457b1dc3a9ea3bc23d1ad463b10d76b5e @limhoff-r7 limhoff-r7 committed Jan 18, 2013
Showing with 8 additions and 6 deletions.
  1. +8 −0 .simplecov
  2. +0 −6 spec/spec_helper.rb
@@ -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
SimpleCov.configure do
# ignore this file
add_filter '.simplecov'
@@ -11,12 +11,6 @@
# 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
require 'rspec/core'

0 comments on commit 3c2c808

Please sign in to comment.