Save failed features from #run_all #13

merged 1 commit into from Jul 4, 2011

2 participants


Read and save failed features if #run_all fails. Here's the workflow I'm going for:

  1. Save Feature1
  2. Feature1 -> fail
  3. Save a file somewhere in the codebase
  4. Feature1 -> pass
  5. All features -> Feature2 fail
  6. Save a file somewhere in the codebase
  7. Feature2 -> pass
  8. All features -> pass

From what I can tell, there's no way to tell guard-cucumber to rerun the saved failed features without calling #run_on_change. Here's my Guardfile:

guard 'cucumber', :cli => '--no-profile --drb --color --strict --format progress --format rerun --out rerun.txt',
                  :all_on_start => false do
  watch(%r{^features/support/.+$}) { 'features' }
  watch(%r{^app/assets/.+$})       { 'features' }

  watch(%r{^features/step_definitions/(.+)_steps\.rb$}) do |m|
    Dir[File.join("**/#{m[1]}.feature")][0] || 'features'

  # Rerun failed features

It's cheating, but I'm passing non-feature filenames to guard-cucumber which it's smart enough to ignore. The end result is when an app file is saved, the failed features are rerun.

I've only started using guard yesterday so please let me know if I'm missing something obvious. I wouldn't be surprised. In the mean time, I'm going to give this patch a try today and see how it feels.


Thank you very much for your contribution. I looks fine and I'll released version 0.5.2 that includes your changes.

@netzpirat netzpirat merged commit caf67be into netzpirat:master Jul 4, 2011

Excellent! Thanks for pulling in the commit. I've been using guard-cucumber in my workflow for a few days now and it's fantastic. I can't believe I waited so long to add it to my projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment