I have lots of tests which rely on fixtures being a particular state in
order to pass. For example, one test checks that a User object can have
no
more than 3 associated ‘Page’ objects at a time. That’s a simple example
but
I have more complicated tests too. The problem is I sometimes add a
fixture
without realising it’ll affect the tests and everything blows up.
I’ve taken to creating the a specific state for each test that needs
one,
i.e. before I assert anything, I’ll create new objects from scratch so I
don’t have to use fixtures. This is fine for simple tests but gets
unwieldy
when I’m testing associations between multiple objects.
Just wondering how other people manage situations like this?
alan