[rspec-users] do I use mocking (vs fixtures) for methods that produce results based on non-trivial SQL queries
Scott Taylor
mailing_lists at railsnewbie.com
Fri Sep 5 23:39:26 EDT 2008
On Sep 5, 2008, at 3:39 PM, Greg Hauptmann wrote:
> Ben - I like your suggestion, thanks. I'll start trying to structure
> some of my tests around this concept until there's a better way.
>
> Mark - I'm curious to understand what you actually do re "I personally
> do not use fixtures because my model specs usually don't use a
> "typical" data set. I'll create my own data set for each type of spec,
> often using an object mother to create the valid network of objects."
> Did you just mean that at the start of a test you create test data
> in the database programmatically, as opposed to hard wiring it in a
> fixture?
You might want to check out Dan Manges' post from a while back:
http://www.dcmanges.com/blog/38
There are a ton of plugins out there that implement the idea. I wrote
FixtureReplacement (http://replacefixtures.rubyforge.org/) after this
idea, but there are actually a ton of them out there that do more or
less the same thing - ObjectDaddy, factory_girl).
Scott
More information about the rspec-users
mailing list