[rspec-users] spec'ing the :conditions argument of a find

Pat Maddox pergesu at gmail.com
Thu Oct 30 16:11:11 EDT 2008

Matt Wynne <matt at mattwynne.net> writes:

> On 30 Oct 2008, at 15:58, Zach Dennis wrote:
>> I know the above example breaks the one assertion per test guideline
>> people strive to adhere to, but I think it is ok.  If there are more
>> examples that should be used to make sure find_thingy works then I'd
>> break out a separate describe block and have multiple 'it' examples,
> It also goes to the database, which will make it a slow unit test. I
> personally do pretty much the same thing myself mostly when working
> with ActiveRecord, but it doesn't mean I'm comfortable with it. (And
> it also doesn't mean our unit test suite is anything other than
> shamefully slow)
> I did experiment with a QueryApapter for this purpose which has worked
> out quite well for us. You end up with code like this in the
> Controller:

Scott is working on a SQL parser which would let you write tests that
"hit" the db but keep everything in memory and fast.  Might be worth
checking out for you.


More information about the rspec-users mailing list