[rspec-users] Write tests for objects with lots of dependencies
tribes.romain at gmail.com
Tue Nov 8 01:52:40 EST 2011
I'm writing a Risk-like webgame
(https://github.com/Sephi-Chan/Conquest-on-Rails) and I want to add tests,
but it's painful since objects have a lot of dependencies each other.
For instance, I have moved the attack logic in a dedicated class
and I would like to test it.
The problem is that to test an attack, I need to have at least two
ownerships (the relation between a territory and a participation). And to
have two ownerships, I need to have many participations (the relation
between a player and a game), and for that I need players.
It's a lot of setup for a quite simple test.
So, what should I do? Should I write a big setup for my suite? Or can I
write a "sub-suites" with this big setup?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users