简体   繁体   English

有没有办法用guard + guard-rspec强制运行所有规格?

[英]Is there a way to force run all specs with guard + guard-rspec?

Is there something similar to autotest's ctrl+c to force run all specs? 是否有类似于autotest的ctrl + c强制运行所有规格? I'm still working to fine tune my .Guardfile, but for the time being can I force run all specs without restarting guard? 我还在努力调整我的.Guard文件,但暂时可以强行运行所有规格而不重新启动后卫吗? ctrl+c quits guard. ctrl + c退出警卫。

The posix signals that Mark suggests are no longer used to interact with guard. 马克建议的posix信号不再用于与守卫交互。 See the section titled "Interactions" in the README for the new way to interact. 有关新的交互方式,请参阅自述文件中标题为“交互”的部分。

To trigger each guard's run_all method, just hit enter in the guard terminal. 要触发每个守卫的run_all方法,只需在守卫终端点击Enter即可。 To trigger rspec's run_all method, type rspec and hit enter. 要触发rspec的run_all方法,请键入rspec并按Enter键。

https://github.com/guard/guard#interactions https://github.com/guard/guard#interactions

You can interact with Guard and enter commands when Guard has nothing to do. 当Guard无事可做时,您可以与Guard交互并输入命令。 Guard understands the following commands: Guard了解以下命令:

↩: Run all Guards.
h, help: Show a help of the available interactor commands.
r, reload: Reload all Guards.
n, notification: Toggle system notifications on and off.
p, pause: Toggles the file modification listener. The prompt will change to p> when paused. This is useful when switching Git branches, rebase Git or change whitespace.
e, exit: Stop all Guards and quit Guard.

So, basically you go into the terminal where Guard is running and hit enter/return. 所以,基本上你进入Guard正在运行的终端并按下Enter / return。

Probably the easiest thing to do is use Spork , then simplify your Guardfile: 可能最简单的方法是使用Spork ,然后简化你的Guardfile:

# Guardfile
guard 'rspec', :version => 2, :cli => '--drb' do # :cli => is important!
  watch(%r{^spec/}) { "spec" }
  watch(%r{^app/}) { "spec" }
  watch('config/routes.rb') { "spec" }
end

This will run anything in the spec folder when anything in the spec , app , or routes.rb changes, as soon as you save it, and will save you a ton of time. specapproutes.rb中的任何内容发生更改时,这将在spec文件夹中运行任何内容,只要您保存它,就会节省大量时间。

Use the growl (mac) or libnotify (linux) gems to get pop-up notifications. 使用growl (mac)或libnotify (linux)gem来获取弹出通知。 Then you just code in your editor, and shortly after each save you'll get a pop-up pass / fail notification. 然后你只需在你的编辑器中编码,每次保存后不久你就会得到一个弹出通过/失败通知。 If it's a pass you just keep on coding -- if it's a fail you pop over to the terminal and check out what the error is. 如果它是一个传递你只是继续编码 - 如果它是一个失败你弹出到终端并检查错误是什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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