On 9/4/07, Lance Carlson <[EMAIL PROTECTED]> wrote:
> What is the general opinion about fixtures versus mocking and stubbing
> in model specs? I heard from agile on IRC that they save the database
> testing for integration testing, but I also see that the caboose
> sample applicaiton uses fixtures. I also noticed that on the rspec
> site, it says "Ironically (for the traditional TDD'er) these are the
> only specs that we feel should actually interact with the database."

I wrote that bit - but it doesn't suggest that you should use fixtures
or not. If I'm going to the DB I generally create the model objects I
want right in the examples.

re: fixtures - the argument against is that they are a pain to
maintain - but there have been some recent developments like
http://code.google.com/p/fixture-scenarios/ that seem promising.

With the recent addition of Story Runner (in trunk), I'm exploring
more and more the ideas espoused by Jay Fields on his blog re: mocking
declarative API calls to AR (see
http://blog.jayfields.com/2006/12/rails-unit-testing-activerecord.html)
to support super-fast object-level examples in concert w/ end-to-end
examples in Story Runner.

So you have two separate issues here:

1. db or not db
2. if db, fixtures or not fixtures

I doubt you'll find general consensus on either question. Good luck!

Cheers,
David
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to