为什么 libnotify 停止显示 Rspec 通知?
我不知道为什么 libnotify 停止显示有关已完成测试的信息。 它显示 Spork 消息:“Rspec 成功启动。”但之后就没有显示任何东西了。我正在使用 Ubuntu。
guard 'spork', :cucumber => false, :rspec_env => { 'RAILS_ENV' => 'test' } do
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.+\.rb$})
watch(%r{^config/initializers/.+\.rb$})
watch('spec/spec_helper.rb')
watch(%r{^spec/support/.+\.rb$})
end
guard 'rspec', :version => 2, :cli => "--drb", :all_on_start => false, :all_after_pass => false do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
watch('spec/acceptance/acceptance_helper.rb') { "spec" }
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
watch('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
# Capybara request specs
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
# watch(%r{^spec/support/(requests|controllers|mailers|models)_helpers\.rb}) { |m| "spec/#{m[1]}" }
# watch(%r{^app/controllers/(.+)_(controller)\.rb}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] }
watch(%r{^app/(.+)\.rb}) { |m| "spec/#{m[1]}_spec.rb" }
end
我的spec_helper:***
当我初始化守卫时:
Running tests with args ["--color", "--format", "progress", "--format", "Guard::RSpec::Formatter::NotificationRSpec", "--out", "/dev/null", "--require", "/home/rege/.rvm/gems/ruby-1.9.2-p290/gems/guard-rspec-0.5.10/lib/guard/rspec/formatters/notification_rspec.rb", "spec"]...
如何诊断问题出在哪里?
编辑:
解决方案: https://github.com/guard/guard- rspec/issues/90#issuecomment-3435651
I don't know why libnotify stoped showing informations about finished tests.
It shows Spork message: "Rspec successfully started." But after that does not show anything. I`m using Ubuntu.
guard 'spork', :cucumber => false, :rspec_env => { 'RAILS_ENV' => 'test' } do
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.+\.rb$})
watch(%r{^config/initializers/.+\.rb$})
watch('spec/spec_helper.rb')
watch(%r{^spec/support/.+\.rb$})
end
guard 'rspec', :version => 2, :cli => "--drb", :all_on_start => false, :all_after_pass => false do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
watch('spec/acceptance/acceptance_helper.rb') { "spec" }
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
watch('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
# Capybara request specs
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
# watch(%r{^spec/support/(requests|controllers|mailers|models)_helpers\.rb}) { |m| "spec/#{m[1]}" }
# watch(%r{^app/controllers/(.+)_(controller)\.rb}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] }
watch(%r{^app/(.+)\.rb}) { |m| "spec/#{m[1]}_spec.rb" }
end
My spec_helper: ***
When I initialize guard:
Running tests with args ["--color", "--format", "progress", "--format", "Guard::RSpec::Formatter::NotificationRSpec", "--out", "/dev/null", "--require", "/home/rege/.rvm/gems/ruby-1.9.2-p290/gems/guard-rspec-0.5.10/lib/guard/rspec/formatters/notification_rspec.rb", "spec"]...
How to diagnose where is the problem?
EDIT:
Solution: https://github.com/guard/guard-rspec/issues/90#issuecomment-3435651
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也遇到了这个问题,并安装了guard-spork(https://github.com/guard/guard-spork)gem(将其添加到我的rails Gemfile并安装了捆绑包)。然后,根据该页面上的说明,我运行了“guard init spork”,它将“spork”部分添加到您的 Guardfile 中,以供您可以观看的文件。
当我运行 Bundle exec Guard 时,它实际上确保 Spork 也启动并很快!我的测试文件更改正在运行,并将结果发布到通知程序。作为记录,我使用 Ubuntu 11.10 64 位和 ruby rvm。我的 Gemfile 中的相关 gem 是 gem 'guard-rspec'、gem 'guard-spork'、gem 'rspec-rails'、gem 'watchr'、gem 'spork'、gem 'libnotify'。不确定是否所有内容都相关。
您可以在 Hartl 出色的 Rails 教程 http:// /ruby.railstutorial.org/chapters/static-pages#sec:guard(第 3.6.2 和 3.6.3 节)。
I had this problem as well and installed the guard-spork (https://github.com/guard/guard-spork) gem (added it to my rails Gemfile and bundle installed). Then, per the instructions on that page, I ran 'guard init spork' which adds a 'spork' section to your Guardfile for files you can watch.
When i ran bundle exec guard, it actually makes sure spork is also started and presto! my test file changes were getting run and the results posted to the notifier. For the record, I use Ubuntu 11.10 64bit with ruby rvm. The relevant gems in my Gemfile were gem 'guard-rspec', gem 'guard-spork', gem 'rspec-rails', gem 'watchr', gem 'spork', gem 'libnotify'. Not sure if all are relevant.
You can find the step by step I used for this in Hartl's awesome Rails tutorial http://ruby.railstutorial.org/chapters/static-pages#sec:guard (sections 3.6.2 and 3.6.3).