是否有类似于自动测试的 ctrl+c 来强制运行所有规范?我仍在努力微调我的 .Guardfile,但目前我可以在不重新启动保护的情况下强制运行所有规范吗?ctrl+c 退出守卫。
问问题
5267 次
3 回答
26
Mark 建议的 posix 信号不再用于与警卫交互。有关新的交互方式,请参阅README中标题为“交互”的部分。
要触发每个守卫的run_all
方法,只需在守卫终端中输入即可。要触发 rspec 的run_all
方法,请键入rspec
并按 Enter。
于 2011-11-18T19:52:07.117 回答
17
https://github.com/guard/guard#interactions
Guard 无事可做时,您可以与 Guard 交互并输入命令。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.
所以,基本上你进入 Guard 运行的终端并按回车键。
于 2012-06-11T00:08:02.397 回答
4
可能最简单的做法是使用 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
当、或中的任何内容发生更改时,这将运行spec
文件夹中的任何内容,一旦您保存它,就会为您节省大量时间。spec
app
routes.rb
使用growl
(mac) 或libnotify
(linux) gem 获取弹出通知。然后您只需在编辑器中编写代码,每次保存后不久您都会收到弹出式通过/失败通知。如果是通过,你只需继续编码——如果是失败,你会跳到终端并检查错误是什么。
于 2011-12-07T21:02:45.473 回答