[rspec-users] How do you keep mocks updated without pain?

Rodrigo Alvarez Fernández papipo at gmail.com
Tue Aug 28 08:21:55 EDT 2007

On 8/28/07, Priit Tamboom <priit.tamboom at eesti.ee> wrote:
> Hi!
> I know you must be answering a lot of basic questions, sorry about that :-)
> However I have not get it, how do you keep mocks updated without pain?
> I reached to the point where mocking things for view. I spec
> model-controller-view using "correct doc" way mocking-stubbing (plus I
> should run integration test to be sure that everything really works
> together).
> Now, when I want to change something in model then basically I have to
> change mocks so many places, haven't I? It really feels a little too
> messy for me as nuby rspecer. Or it's just my worry and you have to be
> so good that you don't have to change things too much after specing
> them? If so then I know that I should think much more when mocking(==
> designing) things.
> When I googled about this topic I have found similar worries out there
> and I got two solutions, where David [1] suggest to write integration
> tests (what should indicate that mocks are outdated) and Ryan [2]
> suggest to fall bact to fixtures.

I guess that each approach has its cons and pros.

The integration test way is the way to go, surely.
Fixtures are really a pain to maintain, and a lot of times you have
records in there that exist just because you need them to one spec.

More information about the rspec-users mailing list