« Return to Thread: Advice with Model tests

Re: Advice with Model tests

by jshen :: Rate this Message:

Reply to Author | View in Thread

"Since I've seen many examples here and
there, I don't know if the right way is to use fixtures or not at all
(in model specs)."

I've personally had a lot of problems with fixtures. One of my current rails apps uses test::unit and fixtures and the fixtures become like spaghetti code very fast. As your tests evolve over time it becomes very hard to manage your fixtures if they aren't super simple. When your writing a new test you don't know if you can add to a certain fixture association or not because it may break some other test in your app. If you delete a test that is no longer necessary you are unsure if you can delete the associated fixture data because some other test may depend on it.

I also agree with david in that it's nice to see everything in the context of the test.

 « Return to Thread: Advice with Model tests