[rspec-users] How to test/spec an ActiveRecord find that uses :include
matt at mattwynne.net
Wed Apr 15 11:16:13 EDT 2009
On 15 Apr 2009, at 15:30, Phlip wrote:
> Fernando Perez wrote:
>> I was refactoring my model specs so that they don't hit the database,
>> but how to handle a custom find that uses :joins or :include with
>> important :conditions? I can't see a way to not hit the database.
> What's wrong with hitting the database?
> When high-end consultants like Mike Feathers tell you not to hit the
> database, what they are really saying is that programmers using big
> iron languages like C++ or Java should start decoupling by any means
> necessary. It's just a mind-game.
> At the other extreme, systems like Rails and its test fixtures have
> illustrated how you can leverage the database for a pool of stub
> objects. It doesn't lead to bad design, or slow tests down.
It doesn't slow tests down!? Are you sure?
More information about the rspec-users