简体   繁体   中英

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? I'm still working to fine tune my .Guardfile, but for the time being can I force run all specs without restarting guard? ctrl+c quits guard.

The posix signals that Mark suggests are no longer used to interact with guard. 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. To trigger rspec's run_all method, type rspec and hit enter.

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

You can interact with Guard and enter commands when Guard has nothing to do. Guard understands the following commands:

↩: 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.

Probably the easiest thing to do is use Spork , then simplify your 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.

Use the growl (mac) or libnotify (linux) gems to get pop-up notifications. 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.

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