[rspec-users] Selectively running slow specs on file change with Guard

Ash Moran ash.moran at patchspace.co.uk
Mon Aug 29 18:34:59 EDT 2011

Hi all (again)

Sorry for the new thread, but I don't have a copy of my own email in my inbox to reply to.

Anyway I managed to cobble together a hack to make Guard filter slow specs by default, but unfilter them if the slow file itself was changed. I've Gisted the relevant sections of my Guardfile and spec_helper.rb[1].

It's not very elegant, and it will probably be possible to make a much better version when the "hook" branch[2] of Guard is merged into master. But in the mean time it's giving me near-instantaneous spec runs for my whole codebase. Admittedly it's still a small project at the moment, but at 659 examples/sec on my MBP, it has plenty of room to grow now…

Hope that's of some use to somebody!


[1] https://gist.github.com/1179590
[2] https://github.com/guard/guard/tree/hook


More information about the rspec-users mailing list