[rspec-users] DRY up story

Yi Wen hayafirst at gmail.com
Tue Jun 24 14:54:10 EDT 2008


In David's presentation @ RailsConf, he has this example:

Story: measure progress towards registration goals
As a conference organizer
I want to see a report of registrations
So that I can measure progress towards registration goals

Scenario: one registration shows as 1%
Given a goal of 200 registrations
When 1 attendee registers
Then the goal should be 1% achieved

Scenario: one registration less than the goal shows as 99%
Given a goal of 200 registrations
When 199 attendees register
Then the goal should be 99% achieved

Notice that Given part is exactly the same for both scenarios. Does it
possible to DRY up it a little bit by putting Given up to right after
Story part? Or it is just too crazy?

Yi


More information about the rspec-users mailing list