我正在使用 Ruby-1.9.2 和 rails-3.1.3 在 ubuntu 机器上工作。我使用guard-rspec 进行自动测试和spork 作为DRB 服务器。
当我在没有 spork 的情况下运行后卫时,它会显示正确的通知。但是guard with 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
最佳答案
我知道这是一个老问题,但是通过 Google 找到的并且只是在解决同样的问题。
解决方法很简单。
使用guard-spork (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
关于ruby-on-rails - 当 guard-rspec 与 spork 一起使用时没有通知,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8633229/