'rake spec' works, 'spec spec' doesn't
When I added my first gem dependency to config/environment.rb
, (will_paginate
), I'm encountering an error when running rspec as follows:
nik$ spec spec/
Missing these required gems:
will_paginate
You're running:
ruby 1.8.6.369 at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
rubygems 1.3.7 at /Users/nik/.gem/ruby/1.8, /Library/Ruby/Gems/1.8, /System/Library/F开发者_开发问答rameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
Run `rake gems:install` to install the missing gems.
It's not picking up the first ruby
binary in my $PATH, which I installed with macports:
nik$ ruby -v
ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-darwin9]
nik$ which ruby
/opt/local/bin/ruby
Curiously, rake spec
succeeds:
nik$ rake spec
(in /Users/nik/rails_projects/bigchan)
....................................................................................
Finished in 2.314131 seconds
84 examples, 0 failures
You have different commands looking up different versions of ruby, hence - different sets of gems.
$ which -a ruby
will show you at least two versions of ruby.
- ruby 1.8.6.369 probably in
/usr/bin
(used when runningspec spec/
) - ruby 1.8.7.299 in
/opt/local/bin
(used when runningrake spec
)
Nuke the one you don't need and everything related to it.
精彩评论