[rspec-users] Specs versus Stories

Jarkko Laine jarkko at jlaine.net
Tue Feb 19 07:52:52 EST 2008

On 19.2.2008, at 12.32, Fernando Perez wrote:

> Andrew,
> By testing your views before the controllers and models, aren't you
> wasting time on adjusting tests as you make changes to the views?
> I see many people postpone the testing of views to the very late stage
> of development, so that they don't get distracted.

One of the founding principles of BDD is the concept of "outside in".  
In Rails that naturally means the process Andrew described. By  
starting from what your views need, you have a better understanding of  
what you need from the controller action and related models, so you  
have a good foundation from where you start speccing them when you  
drill down towards the core.

That also follows one of the 37signals' mantras that is worth  
repeating: "the interface is the application".

If changing some small things (like a <p> to <div>) in the views  
breaks your specs, you're probably speccing wrong things. I always try  
to spec for logical things, not the actual tags, for example. That is  
not always an option, of course.


Jarkko Laine

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2417 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/rspec-users/attachments/20080219/774ab30e/attachment.bin 

More information about the rspec-users mailing list