Eric M.
Eric M.

Reputation: 5539

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.

Upvotes: 4

Views: 5433

Answers (3)

Day Davis Waterbury
Day Davis Waterbury

Reputation: 2132

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.

Upvotes: 17

brittohalloran
brittohalloran

Reputation: 3634

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.

Upvotes: 4

balexand
balexand

Reputation: 9665

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.

Upvotes: 27

Related Questions