Rails 3 - 如果我使用RSpec,我可以删除'test'文件夹吗?

问题描述:

虽然试图迁移,我不断收到此错误:Rails 3 - 如果我使用RSpec,我可以删除'test'文件夹吗?

rake aborted! 
test-unit is not part of the bundle. Add it to Gemfile. 

如果我使用RSpec的,可我只是删除test文件夹干脆?

+0

另请参阅:http://*.com/questions/5072662/how-to-remove-unit-test-and-replace-it-with-rspec – 2012-06-23 20:17:52

这个错误意味着你的项目中有一个require test-unit而没有在Gemfile中指定它。

所以你其实应该设法找到这一声明,并删除它来修复这个错误(或添加依赖到Gemfile中 - 但听起来倒退,如果你不使用它一点)。

无论如何:如果您使用的是rspec,您肯定可以删除test文件夹。

+0

谢谢。非常感激。 – teecraft 2010-10-12 21:48:29

+1

通常情况下,如果你使用的测试单元,在'/配置/ application.rb'应该有一个'需要“轨/ test_unit/railtie'' - 这可能是什么绊倒你。 – theTRON 2011-06-05 12:02:46

我相信是的。 Rspec只应该在../spec/*中寻找测试

是的,您可以删除测试文件夹。

如果你想测试单元,但(由于其他宝石依赖)这里是如何安装的测试单元作为宝石:

  1. 添加宝石的Gemfile

    gem 'test-unit'

  2. 检查宝石

    bundle check

    您的Gemfile的依赖关系无法满足 安装缺少的宝石,bundle install

  3. 安装

    bundle install

应该是好去。