[rspec-users] Keeping unit tests from hitting the DB

Jim Deville james.deville at gmail.com
Fri Aug 24 00:33:42 EDT 2007

> As far as model specs go...I've been toying with the idea of splitting
> up non-db-reliant behavior specs from the specs that do require the
> database.  When you want to specify behavior you can just stub out the
> columns (because AR does try to hit the db to find the column info).
> Obviously for things where you need to hit the db, such as custom
> finders and such, you should use a real db.  Kent Beck proposed
> writing a mock db interface that expects SQL queries but I thoroughly
> hate that idea.

I'm wondering why custom finders need to hit the database? Mocking  
out the columns method (as suggested by the articles) should work  
just as well for custom finders as it would for AR finders.   Am I  
missing something?


> Pat
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list