Phoenix Rising
2010-Oct-22 21:21 UTC
[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. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Erol Fornoles
2010-Oct-23 08:00 UTC
Re: [Rails 3] Appears test DB isn''t being cleared when using shoulda - what am I doing wrong?
On Sat, Oct 23, 2010 at 5:21 AM, Phoenix Rising <polarisrising-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> 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.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://github.com/Erol http://twitter.com/erolfornoles http://ph.linkedin.com/in/erolfornoles -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Oct-24 04:15 UTC
Re: [Rails 3] Appears test DB isn''t being cleared when using shoulda - what am I doing wrong?
did you remember to put { } in the values of the factories to make them lambdas?, also try using Faker -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.