2011-12-26 69 views
4

我正在使用Ruby-1.9.2和rails-3.1.3在ubuntu機器上工作。我使用guard-rspec進行自動測試,並使用spork作爲DRB服務器。

當guard-rspec與spork一起使用時沒有通知

當我沒有spork跑衛兵,它顯示正確的通知。但與spork保衛顯示沒有通知。
這裏是我的Gemfile

group :test, :development do 
    gem 'rake', '0.9.3.beta.1' 
    gem 'turn' 
    gem 'rspec-rails' 
    gem 'rspec' 
    gem 'guard-rspec' 
    gem 'spork' 
    gem 'webrat' 
    gem 'rb-fchange' 
    gem 'rb-fsevent' 
    gem 'libnotify' 
end 
+0

你可以發佈你的guardfile。 – nmott 2012-01-08 12:28:59

回答

2

的相關部分,我知道這是一個老問題,但通過谷歌找到,只是同樣的問題掙扎。

解決方案非常簡單。

使用護叉勺(https://github.com/guard/guard-spork)

gem 'guard-rspec' 
    gem 'guard-spork' 
    gem 'libnotify' 

添加在Guardfile的頂部(RSpec的定義之前):

guard 'spork' do 
    watch('config/application.rb') 
    watch('config/environment.rb') 
    watch(%r{^config/environments/.*\.rb$}) 
    watch(%r{^config/initializers/.*\.rb$}) 
    watch('Gemfile') 
    watch('Gemfile.lock') 
    watch('spec/spec_helper.rb') { :rspec } 
    watch('test/test_helper.rb') { :test_unit } 
    watch(%r{features/support/}) { :cucumber } 
end 

運行

bundle exec guard 
+0

這也適用於我(Ubuntu 12.04 LTS),謝謝!你能解釋一下保衛區塊的變化以及爲什麼需要變更嗎?我仍然試圖通過rails等方式來處理ruby。 – 2013-05-24 09:49:34

+0

找到匹配的教程代碼:http://ruby.railstutorial.org/chapters/static-pages?version=4.0#sec-spork_and_guard – 2013-05-24 09:59:37

相關問題