If you're like me, you've found yourself with a cucumber step definition like this:
And you want to write a step definition like this:
Instead of doing all that extra work, I threw together a cucumber step that lets you add times to any existing step definition:
To make things even easier I created a gem called Timebomb. It lets you append time constraints to your cucumber step defintions by mixing and matching:
- seconds, minutes, hours, days, weeks, months, years
- ago, from now
So with the following step definition:
I can write any of the following:
- Given I received an invitation 1 day from now
- Given I received an invitation 2 weeks ago
- Given I received an invitation 3 months from now
- Given I received an invitation 15 years ago
Timebomb to the rescue, BOOM!
== Installing ==
First install Timebomb
- sudo gem install timebomb --source http://gemcutter.org
Now, just require it in your cucumber env.rb file. BOOM goes the dynamite.
Saturday, November 14, 2009
Subscribe to:
Post Comments (Atom)
1 comments:
Clever!
Post a Comment