0

嗨,这是我的 Gemfile 中的广告摘录:

#Gemfile
gem 'rspec-rails'
gem 'capybara'
gem 'factory_girl_rails'

现在,当运行 rails generator 命令时,我遇到了这个错误:

.rvm/gems/ruby-2.0.0-p247@psitoNegozio/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require': cannot load such file -- spec_helper (LoadError)

添加:当我给乘客服务器加星时,同样的问题:

[ 2013-10-25 17:26:43.4976 8776/7f8c6a60f700 Pool2/Spawner.h:738 ]: [App 8808 stdout] 
[ 2013-10-25 17:26:46.3407 8776/7f8c6a60f700 Pool2/Implementation.cpp:849 ]: Could not spawn process for group /home/cristiano/Dropbox/railsProject/sitoNegozio#default: An error occured while starting up the preloader.
     in 'void Passenger::ApplicationPool2::SmartSpawner::handleErrorResponse(Passenger::ApplicationPool2::SmartSpawner::StartupDetails&)' (SmartSpawner.h:455)
     in 'std::string Passenger::ApplicationPool2::SmartSpawner::negotiatePreloaderStartup(Passenger::ApplicationPool2::SmartSpawner::StartupDetails&)' (SmartSpawner.h:558)
     in 'void Passenger::ApplicationPool2::SmartSpawner::startPreloader()' (SmartSpawner.h:206)
     in 'virtual Passenger::ApplicationPool2::ProcessPtr Passenger::ApplicationPool2::SmartSpawner::spawn(const Passenger::ApplicationPool2::Options&)' (SmartSpawner.h:744)
     in 'void Passenger::ApplicationPool2::Group::spawnThreadRealMain(const Passenger::ApplicationPool2::SpawnerPtr&, const Passenger::ApplicationPool2::Options&, unsigned int)' (Implementation.cpp:782)

[ 2013-10-25 17:26:46.3411 8776/7f8c53fff700 agents/HelperAgent/RequestHandler.h:1956 ]: [Client 20] Cannot checkout session. An error occured while starting up the preloader.
Error page:
cannot load such file -- spec_helper (LoadError)

我不知道,你能帮帮我吗?

4

1 回答 1

0

最可能的原因是您试图在 Rails 应用程序中包含 RSpec。这绝不应该发生;你的 RSpec 测试应该包括 Rails,而不是相反。

我能想到的最可能的问题是您将测试文件放在 Rails 会自动加载它们的地方。这就是链接问题中的答案最终会解决的问题。另一种可能性是您实际上require "spec_helper"在某个地方输入了 Rails 代码。

于 2013-10-26T16:06:55.167 回答