“耙子规格”作品,“规格规格”;没有
当我将第一个 gem 依赖项添加到 config/environment.rb
(will_paginate
) 时,我在运行 rspec 时遇到错误,如下所示:
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/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
Run `rake gems:install` to install the missing gems.
它没有拾取第一个我使用 macports 安装了 $PATH 中的 ruby 二进制文件:
nik$ ruby -v
ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-darwin9]
nik$ which ruby
/opt/local/bin/ruby
奇怪的是,rake spec 成功了:
nik$ rake spec
(in /Users/nik/rails_projects/bigchan)
....................................................................................
Finished in 2.314131 seconds
84 examples, 0 failures
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/Frameworks/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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你有不同的命令来查找不同版本的 ruby,因此 - 不同的宝石集。
将向您展示至少两个版本的 ruby。
/usr/bin
中(运行spec spec/
时使用)/opt/local/bin
中(运行rake spec
时使用)删除你不需要的东西以及与之相关的所有东西。
You have different commands looking up different versions of ruby, hence - different sets of gems.
will show you at least two versions of ruby.
/usr/bin
(used when runningspec spec/
)/opt/local/bin
(used when runningrake spec
)Nuke the one you don't need and everything related to it.