为什么我的 Rails 应用程序找不到与其一起打包的 gem?
我有一个使用 Cucumber 和 RSpec 的 Rails 应用程序。我们将 gems 存储在供应商/gems 下,并尝试在 CI 服务器中构建应用程序(运行测试)。
当我尝试运行测试时,出现以下错误:
Missing these required gems:
cucumber >= 0.3.11
rspec-rails >= 1.2.6
当我运行 RAILS_ENV=test rake gems
时,出现以下错误:
- [F] activerecord-oracle-adapter
- [R] activerecord >= 1.15.5.7843
- [F] thoughtbot-factory_girl = 1.2.0
- [F] cucumber >= 0.3.11
- [ ] term-ansicolor >= 1.0.3
- [ ] treetop >= 1.2.6
- [ ] diff-lcs >= 1.1.2
- [I] builder >= 2.1.2
- [F] webrat >= 0.4.4
- [I] nokogiri >= 1.2.0
- [F] rspec >= 1.2.6
- [F] rspec-rails >= 1.2.6
- [F] rspec >= 1.2.7
- [ ] rack >= 0.4.0
- [F] thoughtbot-shoulda >= 2.10.2
I = Installed
F = Frozen
R = Framework (loaded before rails starts)
空白 [ ] 是否意味着 gem 丢失?
config/environments/test.rb 包含以下内容:
config.gem "cucumber", :lib => false, :version => ">=0.3.11" unless File.direct
ory?(File.join(Rails.root, 'vendor/plugins/cucumber'))
config.gem "webrat", :lib => false, :version => ">=0.4.4" unless File.direct
ory?(File.join(Rails.root, 'vendor/plugins/webrat'))
config.gem "rspec", :lib => false, :version => ">=1.2.6" unless File.direct
ory?(File.join(Rails.root, 'vendor/plugins/rspec'))
config.gem "rspec-rails", :lib => "spec/rails", :version => ">=1.2.6" unless File.direct
ory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
config.gem "thoughtbot-shoulda", :lib => false, :version => ">=2.10.2" unless File.direct
ory?(File.join(Rails.root, 'vendor/plugins/shoulda'))
所以一切看起来都按顺序进行,但它仍然拒绝运行。
我错过了一些明显的东西吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您的
vendor/gems
中已冻结(解压)了cucumber
、rspec
和rspec-rails
目录,但缺少 cucumber 和 rspec-rails 的依赖项。正如对该问题的评论所述,[]
表示缺少。我会重新开始:
然后在本地安装 gem:
此时您应该能够成功测试应用程序。
最后,如果需要,将其解压到您的
vendor/gems
目录中:或者:
将测试环境的所有内容解压到
vendor/gems
中。这将解压您当前已在本地安装但未冻结到应用程序中的nokogiri
gem。It looks like you have
cucumber
,rspec
, andrspec-rails
frozen (unpacked) in yourvendor/gems
directory but you are missing dependencies forcucumber
andrspec-rails
. As the comment on the question says,[]
indicates that is missing.I would start over:
Then install the gems locally:
At this point you should be able to test the app successfully.
Finally, unpack then into your
vendor/gems
dir if desired:or alternatively:
to just unpack everything for the test environment into
vendor/gems
. This would unpack thenokogiri
gem you currently have installed locally but not frozen into the app.