2010-10-12 33 views
15

雖然試圖遷移,我不斷收到此錯誤:Rails 3 - 如果我使用RSpec,我可以刪除'test'文件夾嗎?

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

如果我使用RSpec的,可我只是刪除test文件夾乾脆?

+0

另請參閱:http://stackoverflow.com/questions/5072662/how-to-remove-unit-test-and-replace-it-with-rspec – 2012-06-23 20:17:52

回答

21

這個錯誤意味着你的項目中有一個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

0

我相信是的。 Rspec只應該在../spec/*中尋找測試

0

是的,您可以刪除測試文件夾。

如果你想測試單元,但(由於其他寶石依賴)這裏是如何安裝的測試單元作爲寶石:

  1. 添加寶石的Gemfile

    gem 'test-unit'

  2. 檢查寶石

    bundle check

    您的Gemfile的依賴關係無法滿足 安裝缺少的寶石,bundle install

  3. 安裝

    bundle install

應該是好去。

相關問題