[rspec-users] Granularity in stories (was Straw Poll: How are you using plain text stories (in rails)?)
baz at madeofstone.net
Wed Aug 6 11:04:01 EDT 2008
On 6 Aug 2008, at 15:47, Christopher Bailey wrote:
> But, yes, since starting to use stories, I'd guess I've written maybe
> two or three controller tests, and have wound up deleting many of my
> view tests (and don't use Rails integration tests at all). So,
> essentially, what it's boiling down to for me, is that I have my
> examples for models, and then use stories for everything else. There
> have been a few tricky cases to do with stories, but otherwise I just
> like it far better, and feel it's a much better and more effective way
> to test since it's going to emulate what really happens on your site.
I've not used stories in anger yet (although my current personal
project is gathering a large selection of text stories as I think of
The thing that's been holding me back is the granularity.
Do you try and write a scenario for every possible case?
For example, if my story was about signing up for an account, would
you write a sign up story with scenarios for success and scenarios
for failure (and let your controller/model specs deal with the
individual reasons that the signup may fail) or would you have
scenarios for "username is taken", "password and confirmation do not
match" etc (effectively making the other tests slightly redundant, as
Web design and development: http://www.3hv.co.uk/
Nottingham Forest: http://www.eighteensixtyfive.co.uk/
Serious Rails Hosting: http://www.brightbox.co.uk/
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users