Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

`require 'rspec/autorun'` when running rcov

- Fixes #370.
  • Loading branch information...
commit 90db0907e378c6551895b6a36fdde92d04e056c7 1 parent 899c679
@dchelimsky dchelimsky authored
Showing with 3 additions and 0 deletions.
  1. +1 −0  features/
  2. +2 −0  lib/rspec/core.rb
1  features/
@@ -4,6 +4,7 @@
* Bug fixes
* Don't extend nil when filters are nil
+ * `require 'rspec/autorun'` when running rcov.
### 2.6.0 / 2011-05-12
2  lib/rspec/core.rb
@@ -26,6 +26,8 @@
require 'rspec/core/version'
require 'rspec/core/errors'
+require 'rspec/autorun' if $0.split(File::SEPARATOR).last == 'rcov'
module RSpec
autoload :Matchers, 'rspec/matchers'

9 comments on commit 90db090


This fix is only partial, it fails for the case when bundler is used and rcov is executed via bundle exec.

Something like this would do the trick:
require 'rspec/autorun' if $0.split(File::SEPARATOR).last == 'rcov' or [$0, $1, $2].join(" ") == 'bundle exec rcov'


@sundbp - lots of people use aliases for bundle exec, so that wouldn't solve this problem. Would you do me a favor and raise an issue on this so we have a better place for the conversation?


Ah, right. Sure, done.


I was having problems running rcov in cucumber as it was running rspec after my features:

bundle exec rcov "....cucumber-0.10.7/bin/cucumber" -o "rcov" --rails --exclude osx\/objc,gems\/,spec\/  -- -t @doesnotexist
Bundling your gems. This may take a few minutes on first run.
Using the default profile...
0 scenarios
0 steps
No examples matched {:doesnotexist=>true}.

Finished in 0.00004 seconds
0 examples, 0 failures

I didn't really look into this long enough (finding this took ages), but commenting out this line made my cucumber features run again like normal. Did I do something wrong somewhere else or is this line not good enough?


@caifara - interesting situation - bundler is requiring 'rspec/core' because it's part of the bundle. Try adding gem 'rspec-core', :require => false to your Gemfile. That should be ok because your spec_helper probably requires what it needs from rspec for when you run specs. Let me know if that works.


That works, but I also use email_spec which requires rspec so I'm yet again running rSpec after cucumber ( Should I raise an issue over there (I'm afraid other libraries may also require rspec, so this may not be the most effective solution).


There's really nothing that other gems that actually depend on rspec can do here. Would you do me a favor and raise this as a new issue and reference this thread? We're probably going to need a different solution in rspec itself.


Here you are: #431



Please sign in to comment.
Something went wrong with that request. Please try again.