De-@wip Your Cucumber Stories

We've been really hitting the Cucumber hard in the recent few iterations of our current project. Now that we're ping pong pair programming, the Cucumber story is the first thing we write, and we revisit regularly during the red-green-refactor cycle.

To make this easy, we place a @wip work in progress tag at the top of the current stories:

Feature: Make coffee

  # This one is done.
  Scenario: First coffee of the day

  # This is the one we're working on.
  @wip
  Scenario: Afternoon perk up

Then we use cucumber -t wip to run just the stories in progress. Once the stories are green and we're happy to move on, we often forget to remove the @wip tags before committing. I wrote a little sed command in a bash alias to make this easier:

# Remove any @wip tags from Cucumber features.
alias dewip="sed -E -i '' -e '/^[[:blank:]]*@wip$/d;s/,[[:blank:]]*@wip//g;s/@wip,[[:blank:]]*//g' features/**/*.feature"

Throw it in your .bash_profile for ease of access! Here's a gist for your forking pleasure.