【问题标题】:No notification when guard-rspec is used with spork当guard-rspec 与spork 一起使用时没有通知
【发布时间】:2011-12-26 05:43:50
【问题描述】:

我正在使用 Ruby-1.9.2 和 rails-3.1.3 开发 ubuntu 机器。我正在使用guard-rspec 进行自动测试,并使用spork 作为DRB 服务器。

当我在没有 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

【问题讨论】:

    标签: ruby-on-rails rspec spork libnotify


    【解决方案1】:

    我知道这是一个老问题,但通过谷歌找到了,只是遇到了同样的问题。

    解决方法很简单。

    使用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
    

    【讨论】:

    • 这对我也有用(Ubuntu 12.04 LTS),谢谢!你能解释一下对保护块的改变是什么以及为什么需要它吗?我仍在努力掌握 ruby​​ on rails 等。
    • 找到匹配教程码:ruby.railstutorial.org/chapters/…
    猜你喜欢
    • 2011-12-11
    • 1970-01-01
    • 2012-03-05
    • 1970-01-01
    • 2012-04-11
    • 2011-12-31
    • 2013-09-20
    • 2012-05-27
    • 2013-10-05
    相关资源
    最近更新 更多