[rspec-users] Best practices: How small to make examples?

Matt Wynne matt at mattwynne.net
Sun Apr 5 05:24:50 EDT 2009


On 5 Apr 2009, at 03:56, Brandon Olivares wrote:

> Hi,
>
> How small should examples be?
>
> Let's say I have a form, should there be one example per field? If  
> there's a
> dropdown, should I describe the dropdown and have one example per  
> option? I
> thought that at first but now, because of the duplication and sheer
> verbosity, it seems too much.
>
> So what do you think?

http://blog.jayfields.com/2007/06/testing-one-assertion-per-test.html

Again, I would urge you to listen to the tests and question whether  
writing unit tests for your views is worthwhile. If you're finding it  
a hassle, there might be a reason for that :)

Matt Wynne
http://blog.mattwynne.net
http://www.songkick.com



More information about the rspec-users mailing list