2013-03-27 20 views
2

我正在使用Test :: Unit(2.5.4)和Shoulda(2.10.2)如何配置Guard以跳過Pry提示並運行我更改的測試?

在Ruby(1.8.7)上運行Rails(2.3.18)的內部Rails應用程序Guard(1.6.2)在啓動時通過guard-test(0.7.0)運行所有測試,但它隨後會進入Pry(0.9.10)提示符,而不是偵聽文件更改。我沒有Pry在我的Gemfile中,但它出現在我的Gemfile.lock下的Guard下,

我使用Guard的唯一原因是在文件更改時重新運行測試,它爲我的寶石和其他項目...如果我點擊[enter],所有的測試都會運行,但這需要比我期望它運行的文件長得多的時間。

後衛顯示:

all_after_pass : true 

    all_on_start : true 

    keep_failed : true 

    test_paths  : ["test"] 

Guardfile:

guard :test do 

    watch(%r{^test/.+_test\.rb$}) 

    watch('test/test_helper.rb') { "test" } 

end 

如何配置衛隊跳過撬提示,只是運行我改變了測試?

+0

我要補充,我不想禁用互動*,因爲我想打[進入]運行在特定點的所有測試的能力在重構中。 *作爲推薦這裏:http://stackoverflow.com/questions/13170077/why-is-guard-stopping?rq=1 – SciPhi 2013-03-27 23:05:19

+0

我遺漏了文件系統事件gem info:rb-fsevent(0.9.3) – SciPhi 2013-03-27 23:11:10

+0

它doesn不要放在Pry遊戲機*上,而要注意變化。它下降到Pry控制檯*然後*觀察變化。你確定你的watch()配置是正確的嗎?目前還不清楚是否'RB-fsevent'你 – 2013-03-27 23:53:19

回答

0

Guard Wiki摘自:

If you are on Mac OS X and have problems with either Guard not reacting to file changes or Pry behaving strangely, then you probably suffer under a Ruby build that uses `libedit` instead of `readline`.

所以我強烈建議遵循在保護維基的說明,並與適當的Readline支持重新編譯你的Ruby版本。

作爲替代方案,你也可以使用老版本衛隊1.4.0自帶的簡單gets基於交互器,看到老README對於該版本支持的功能。爲了讓簡單的交互器,添加

interactor :simple

Gemfile

+0

加入「RB-的ReadLine」到Gemfile中沒有的伎倆(股票運行Mac OS X的紅寶石) – SciPhi 2013-03-28 14:17:07

0

我這樣做是使用no_interations選項,首發後衛編程

Guard.start :no_interations => true` 
相關問題