[rspec-users] validate_presence_of

Yi Wen hayafirst at gmail.com
Wed Feb 18 23:42:50 EST 2009

We should write a test/spec, whatever you call it, *first* before you want
your code. But it doesn't mean one who writes the spec/test will use a
monkey coding the code to fix the test. To be realistic, a programmer will
write this test, and implement it right away. Just like how TDD should be

Without this syntax sugar, we still have to test validates_presence_of to
make sure it's there and won't broken, right? So this simple syntax is nice
because it's lees code to type in. I really don't see how trained monkeys
come into play in this scenario. :)

I am not a huge fan of "spec contract" for unit testing. Unit testing is a
tool for developers to write better, DRY-er and more loosely-coupled code.
At most it is a communication tool among developers. It's never meant to be
for non-technical / clients / business people. Cucumber might serve that


On Wed, Feb 18, 2009 at 7:47 PM, Alex Satrapa <grail at goldweb.com.au> wrote:

> On 19/02/2009, at 11:39 , Fernando Perez wrote:
>  What's the point in testing validates_presence_of for a model? It's
>> already tested in the framework, and so readable that a quick glance on
>> the model says it all.
> Some people want the spec to stand as a contract, so you can then hand the
> spec over to the proverbial trained monkeys and have them write all the
> necessary code from scratch exactly the way you want it written.
> These are not people I enjoy working with, so I play loose with the specs
> and only spec stuff that matters to me at the time, code that little bit,
> and get on with the next terribly pressing task.
> Alex
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090218/4f5d4a15/attachment-0001.html>

More information about the rspec-users mailing list