简体   繁体   中英

No notification when guard-rspec is used with spork

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.

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

I know it is an old question, but found via Google and just struggle with same problem.

Solution is quite easy.

Use guard-spork (https://github.com/guard/guard-spork)

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

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

run

bundle exec guard

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM