[Rails 3] Appears test DB isn't being cleared when using shoulda - what am I doing wrong?

Hey guys,

Chances are there’s probably something I just plain missed here, but
for some reason it appears that my test DB isn’t being cleared out
between tests when using shoulda with Rails 3.

I’m calling tests via rake test:[units/functionals], and my tests
exist in the usual place. Shoulda is installed with
factory_girl_rails and both appear to be working properly in and of
themselves. However, I’m getting a lot of validation errors with each
of my tests because various names and such are already taken when a
given test runs, because records were created based off the same
factories in another test that runs prior.

Does anyone have any ideas as to what I could be missing here? Is
there a hidden option that I have to configure to tell it to blow away
test data between each test? I thought Test::Unit was supposed to do
that automagically, but maybe I’m missing something.

Thanks for any help you can provide. It’s appreciated.

On Sat, Oct 23, 2010 at 5:21 AM, Phoenix R.
[email protected]wrote:

of my tests because various names and such are already taken when a
given test runs, because records were created based off the same
factories in another test that runs prior.

Does anyone have any ideas as to what I could be missing here? Is
there a hidden option that I have to configure to tell it to blow away
test data between each test? I thought Test::Unit was supposed to do
that automagically, but maybe I’m missing something.

Thanks for any help you can provide. It’s appreciated.

I remember encountering something like this before. Could you give a
sample
test which shows how and where the factories are being called?


Erol M. Fornoles
http://erolfornoles.posterous.com

http://twitter.com/erolfornoles
http://ph.linkedin.com/in/erolfornoles

did you remember to put { } in the values of the factories to make them
lambdas?, also try using Faker