[rspec-devel] Stories vs. examples

Jake Howerton jake.howerton at gmail.com
Wed Nov 7 18:39:43 EST 2007


The question is ... where do we want to abstract.  If we abstract in
the stories you might come up with the bottom example.  Although I
think the top could be written alot more succintly than its current
form.  If we abstract in the steps, we might have more verbose
stories, but the steps can be much more reusable and less actual code
would get written.

Honestly most of my existing stories ( Not actually written by me)
map much better to the detailed implementation than the abstract.
Stories that get written by non programmers are going to have data in
them.   "When I click on the Widgets Inc logo it blows up!" etc.

Jake

> Given an empty checking and savings account
> And visiting the Money Transfer page
> And typing transfer amount $20
> And selecting from account "Checking"
> And selecting to account "Savings"
> When clicking "Transfer"
> Then user should see error message "Insufficient funds"
> And checking account should have balance $0
> And savings accounts should have balance $0
>
> What about:
>
> Given an empty checking and savings account
> When user tries transferring $20 from checking to savings
> Then user should see message "Insufficient funds"
> And checking account should have balance $0
> And savings accounts should have balance $0
>
> The clicks, typing and selects still happen behind the scenes, but
> aren't really important at the story level.


More information about the rspec-devel mailing list