[英]Problems with Guard, Spork, Rspec & Rails 3
我跟着spork railscast視頻 ,當我試圖守衛時,它給了我以下錯誤:
Guard is now watching at '/Users/m/work/'
Starting Spork for Test::Unit & RSpec
Couldn't find a supported test framework that begins with 'testunit'
Supported test frameworks:
( ) Cucumber
(*) RSpec
Legend: ( ) - not detected in project (*) - detected
Using RSpec
Preloading Rails environment
Loading Spork.prefork block...
Spork is ready and listening on 8989!
--> ERROR: Could not start Spork server for Test::Unit & RSpec. Make sure you can use it manually first.
Guard::RSpec is running, with RSpec 2!
Running all specs
它看起來像spork服務器啟動正常,然后錯誤,並試圖繼續。 我嘗試過:等待選項120秒,它仍然有同樣的問題。
如果我執行沒有防護和防護裝置的測試,Spork工作正常
環境:
我該如何調試此問題? 我不知道從哪里開始。
我在Ubuntu上遇到了這個問題。 我的解決方案很簡單:
1)我停止了警惕
2)我刪除了測試文件夾
3)開始守衛
這一次,我沒有看到Begin Spork for Test :: Unit和RSpec,而是為RSpec開始Spork。 所以spork自動識別出我的測試文件夾不再需要了,一切都運行得很好。
有趣的是
Supported test frameworks:
( ) Cucumber
(*) RSpec
消息也消失了,我按照railscast獲得了預期的結果。
我能想出的唯一結論是:
1)這不是依賴於操作系統的問題。
2)spork,rspec和測試單元在Rails> v3.x應用程序上不能很好地發揮作用。 你不需要兩者。 更新 - 如果您需要,請參閱下面的更新答案。
顯然,我非常密切地遵循Railscast指令,但我認真建議您刪除測試文件夾。
更新應該注意的是,根據以下來自@yuvilio的評論,可以讓兩者很好地一起玩,其引用如下:
我不認為問題在於他們不相處。 我讓Cucumber / Rspec / testunit在spork中互相玩得很好。 在我的gemfile中,除了rspec / cucumber / guard相關的寶石之外,我還添加了spork-testunit,guard-test,ruby-prof gems並運行了bundle install。 然后,我引導testunit:bundle exec spork testunit --bootstrap。然后自定義test / test_helper.rb。 然后更新了監視testunit的保護文件:bundle exec guard init test。 當我守衛時,我獲得了包括Spork服務器的輸出,用於RSpec,Cucumber,Test :: Unit成功啟動
如果您不想刪除測試文件夾,只需告訴guard忽略它:
guard 'spork', test_unit: false do
# ...
end
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.