Re:RSpec Best Practices
by chromatic on Friday October 05, 2012 @02:58PM
(#4618164)
If you can't reason about your objects in isolation, how can you expect to reason about them in aggregate?
I don't use my objects in isolation.
Maybe I can mock up some factory which creates model objects outside of my persistence mechanism, but what value is that? I care that when I create an object in response to an action from a real user the persistence mechanism produces the correct object.
I happily bulk load testing data into my persistence mechanism for testing purposes, but I see almost no reason to mock it for tests.
I don't use my objects in isolation.
Maybe I can mock up some factory which creates model objects outside of my persistence mechanism, but what value is that? I care that when I create an object in response to an action from a real user the persistence mechanism produces the correct object.
I happily bulk load testing data into my persistence mechanism for testing purposes, but I see almost no reason to mock it for tests.