[rspec-users] rspec, rspec-rails 1.1.99-12 and script/spec 'no such file to load -- spec'

Michael K rockrep at gmail.com
Sun Mar 8 16:32:13 EDT 2009

Hi David,

Thanks for the quick reply, info, and patch.

> This fixed and pushed to github
> http://github.com/dchelimsky/rspec-rails/commit/cd15dd5cbd6ca9cf2cd2f...

> > I've seen this with older versions of lib/tasks/rspec.rake that
> > required 'spec'. Basically, when you run any rake task in rails, rake
> > loads up the Rakefile in the project root *and* all of the .rake files
> > in lib/tasks before executing anything. So if any of those files
> > require 'spec', then the rails/gems framework will consider rspec to
> > be loaded already, and won't let you unpack it.
> > Try this:
> > rm lib/tasks/rspec.rake
> > rake gems RAILS_ENV='test'
> > If that changes rspec to [I], then you can unpack it and you should be
> > good to go.

I tried removing rspec.rake again as suggested, but it did not help,
and rspec would still not unpack using 'rake gems:unpack
RAILS_ENV=test'.   The rspec dependency of rspec-rails was marked as
'I', but it still had an 'R' next to the top-level rspec.  I also
tried removing uuidtools (and searched all the other .rake files in my
source tree for references to require 'spec') to see if that had any
effect since it lists a dependency on rspec, but that also did not
help.  I'm showing the full list of my RAILS_ENV=test gem dependencies
here in case the additional info helps.

 - [F] uuidtools
    - [I] rake = 0.8.3
    - [I] rspec =
 - [F] faker
 - [F] populator
 - [F] mislav-will_paginate ~> 2.3.7
 - [R] hpricot = 0.6.164
 - [R] rspec >=
 - [F] rspec-rails >=
    - [I] rspec =
    - [F] rack = 0.9.1
    - [ ] cucumber >= 0.1.13
    - [ ] hoe >= 1.9.0

On a positive note, I managed to resolve this issue by manually
unpacking rspec using 'gem unpack' instead of 'rails gem:unpack'.
Here are the steps I took.  Maybe this will help someone else who runs
into this issue.   Note: config/environments/test.rb already is
configured for rspec and rspec-rails as gem dependencies.

* sudo gem uninstall rspec -v
* sudo gem uninstall rspec-rails -v
* re-cloned, re-built, and re-installed both rspec- and rspec-
rails- to pick up your patch as described in
* rm lib/tasks/rspec.rake
* rm -rf vendor/gems/rspec-
* rm -rf vendor/gems/rspec-rails-
* cd vendor/gems
* sudo gem unpack rspec -v
* sudo chown -R michael:staff rspec-
* rake gems:refresh_specs RAILS_ENV=test   # this because gem unpack
does not create a .specification file
* sudo rake gems:unpack RAILS_ENV=test    # unpacks rspec-rails
* sudo rake gems:unpack:dependencies RAILS_ENV=test    # I had already
done this previously, so didn't need this step, but listed here in
case someone following this hasn't yet
* script/generate rspec

And voila!,  'script/spec' works again!     'rake gems RAILS_ENV=test'
still doesn't show rspec as 'F' which makes me slightly nervous, but
everything is functional again.


More information about the rspec-users mailing list