[Ruby] Testing Models in Rails

Ryan Davis ryand-ruby at zenspider.com
Thu Jul 26 19:54:33 PDT 2007


On Jul 26, 2007, at 10:19 , Aaron Patterson wrote:

> On Thu, Jul 26, 2007 at 01:33:31PM -0700, Laurel Fan wrote:
>> Why are you trying to avoid hitting the database?  I would imagine
>> that avoiding the database makes it hard to test much of anything.
>
> Because hitting the database is expensive.  Actually I've found that
> I can test most of my code without hitting the database.  It makes my
> tests much faster.  The problem here is that I don't know how to  
> assert
> that my callback is defined *without* hitting the database.

it isn't _that_ expensive:

Finished in 68.773742 seconds.
1891 tests, 12052 assertions, 0 failures, 0 errors




More information about the Ruby mailing list