问题描述
我正在使用Ruby-1.9.2和rails-3.1.3.在ubuntu机器上工作.我正在使用guard-rspec进行自动测试并将其作为DRB服务器.
I am working on ubuntu machine with Ruby-1.9.2 and rails-3.1.3. I am using guard-rspec for autotesting and spork as DRB server.
当我不加保护地运行警卫队时,它会显示正确的通知.但是带spork的后卫根本没有任何通知.
这是我的Gemfile的相关部分
When I run guard without spork, it shows the correct notifications. But guard with spork shows no notifications at all.
Here is relevant part of my 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
推荐答案
我知道这是一个老问题,但是可以通过Google找到,并且遇到了同样的问题.
I know it is an old question, but found via Google and just struggle with same problem.
解决方案很容易.
使用guard-spork(https://github.com/guard/guard-spork)
Use guard-spork (https://github.com/guard/guard-spork)
gem 'guard-rspec'
gem 'guard-spork'
gem 'libnotify'
在Guardfile顶部添加(在rspec定义之前):
Add at the top of Guardfile (before rspec definition):
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
这篇关于当spork与guard-rspec一起使用时,没有通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!