I just recently upgraded to Rails 2.3.1RC2 (Mac OS.X 10.5.6, ruby
1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9]) and have been
dilligently following the instructions for upgrading rspec and rspec-
rails according to: http://wiki.github.com/dchelimsky/rspec/rails-with-rspec-gems.
I have successfully built the rspec and rspec-rails gems, installed
and unpacked them, and ran script/generate rspec successfully.
‘rake spec’ works fine, however ‘script/spec’ fails with error:
$ script/spec spec
script/spec:3:in `require’: no such file to load – spec (LoadError)
I = Installed
F = Frozen
R = Framework (loaded before rails starts)
rspec does not exist in vendor/gems, but rspec-rails does. It seems
it’s marked as ‘R’ which (1) I’m not certain I understand why, and (2)
seems to prevent unpacking into vendor/gems. In any case, I would
like to resolve the issue with script/spec.
Since rspec is also not installed in vendor/plugins the LOAD_PATH line
in script/spec looks odd, but I’m not sure it’s the cause.
This bit is a bug that I plan to fix (today), but that’s not the only
problem here.
I = Installed
F = Frozen
R = Framework (loaded before rails starts)
rspec does not exist in vendor/gems, but rspec-rails does. It seems
it’s marked as ‘R’ which (1) I’m not certain I understand why, and (2)
seems to prevent unpacking into vendor/gems. In any case, I would
like to resolve the issue with script/spec.
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.
This bit is a bug that I plan to fix (today), but that’s not the only
problem here.
This fixed and pushed to github
[ ] hoe >= 1.9.0
Just an FYI about the listed dependencies - cucumber and hoe are
developer dependencies of rspec, so you don’t need them to run rspec.
It looks like rails gem management system doesn’t make that
distinction, and shows all dependencies regardless of type.
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 = 1.1.99.12
[F] faker
[F] populator
[F] mislav-will_paginate ~> 2.3.7
[R] hpricot = 0.6.164
[R] rspec >= 1.1.99.12
[F] rspec-rails >= 1.1.99.12
[I] rspec = 1.1.99.12
[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 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.
I’m having similar issues, but when I run the CMD + R command in
Textmate:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/rubygems/custom_require.rb:27:in gem_original_require': no such file to load -- spec (LoadError) from /System/Library/Frameworks/ Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/ custom_require.rb:27:inrequire’ from /Users/robbyc/Library/
Application Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/spec/
mate.rb:14 from /tmp/textmate-command-5945.rb:2:in `require’ from /tmp/
textmate-command-5945.rb:2
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.