[rspec-users] DRYing up stories

Ben Mabey ben at benmabey.com
Wed Jan 23 16:50:43 EST 2008


Neil M. Young wrote:
> I'm finding that I'm writing sets of very similar scenarios to check access
> permissions for each of my actions. Does anyone have suggestions on how to
> dry this up:
>
> Given an existing Account
> And a logged in Admin
> When the user visits account/manage
> Then he should get access
>
> Given an existing Account
> And a logged in Manager
> When the user visits account/manage
> Then he should get access
>
> Given an existing Account
> And a logged in Supervisor
> When the user visits account/manage
> Then he should not get access
>
> Given an existing Account
> And a logged in Reviewer
> When the user visits account/manage
> Then he should not get access
>
> Given an existing Account
> And a logged in User
> When the user visits account/manage
> Then he should not get access
>
>   
I've been running into the same issue.  Ryan Davis came up with the idea 
of a "functional test matrix": 
http://blog.zenspider.com/archives/2007/04/functional_test_matrix.html
borrowing the spreadsheet idea from FIT.. Anyways, I have been trying to 
think of a way to apply something similar in conjunction with stories... 
Maybe generate and run stories based off a matrix for access control 
reasons? 

Does this give any one some ideas?

-Ben


More information about the rspec-users mailing list