[rspec-devel] huge setup methods? I think I'm on the wrong path

David Chelimsky dchelimsky at gmail.com
Wed Jan 24 16:36:19 EST 2007


On 1/24/07, Jens-Christian Fischer <jcfischer.lists at gmail.com> wrote:
> >
> > If the view needs to ask a lot of questions, then your setup is going
> > to look something like that. You can, though, clean things up a little
> > bit:
>
> > [... snip ...]
> > This will cause the mock to ignore calls that it isn't interested in,
> > so you won't get failures by sending messages. If, however, your view
> > has any trainwrecks in it (user.address.zipcode), then you'd have to
> > supply something specific to return for address.
> >
>
> Yes - there are quite a few trainwrecks :-) That's the first time I
> heard that - it sounds like there are some negative cononations with
> that - true?

Google "Law of Demeter". Note that it is called a Law, which makes it
sound absolute. Some refer to it lovingly as the "Suggestion of
Demeter" (I believe Fowler first wrote that). It is a useful guideline
that should be applied when you're feeling pain (which it seems that
you are in this case).

Cheers,
David


More information about the rspec-devel mailing list