There are a couple of camps regarding this, and I tend to fall into
the same camp as James on this, reliance on side-effects is kind of a
code smell.
However, we live in an imperfect world, and sometimes we need tools
that do these things, even if they're not best practices.
One approach to this is to use test spies. Although I haven't used it
myself, Thoughbot has released the Bourne library that integrates with
Mocha and provides test spies.
In some spies implementations, messages flow through the spy to the
original receiver, allowing you to check expectations against the spy
while still getting all your nice side-effects. I don't know whether
Bourne operates this way, or if it simply provides an alternative
interface to Mocha's existing mocks expectations.
https://github.com/thoughtbot/bourne
Anyway, best of luck, hope this helps.
Duncan
> --
> You received this message because you are subscribed to the Google Groups "mocha-developer" group.
> To post to this group, send email to
mocha-d...@googlegroups.com.
> To unsubscribe from this group, send email to
mocha-develop...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/mocha-developer?hl=en.
>