Hello Group. I might be misunderstanding, but this does not make sense to me at all. The reason there is a test database in the first place is that it gives you a reliable state at the beginning of each TestCase/test/context/spec. To me, this implies that when I do not load fixtures at all, I get an empty DB (this IS a boundary condition, and I have to test it). Also between different model''s tests, the DB is never cleaned, given I have no fixtures statements. How can I ensure I have a DB that is clean except for the structure in a TestCase/test/context/spec? Model.delete_all in the setup method? What if I need my fixtures later in the test case? Model.delete_all in the test methods themselves? Another test case? This all looks like workarounds to me. I''d be happy to be proven wrong, but this does look like a design error to me. Wouldn''t it be more concise to just wipe the test DB upon entering a TestCase/context? Regards, Timm Gebhart P.S.: This is my first post to this group. I am a web developer from Germany, and found RoR to be a perfect match for me about 3 months ago. So please excuse my ignorance and grammar errors. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Brian Hogan
2006-Nov-09 18:47 UTC
Re: Why is the test DB not wiped upon entering a test case?
I believe you need to implement the setup and teardown methods in a test case. Otherwise the tests don''t clear out the database. Those methods should be automatically called before and after a test case. Here''s an absolutely fabulous blog post that lists testing resources. http://bparanj.blogspot.com/2006/11/resources-for-testing-ruby-on-rails.html On 11/9/06, onkeltimm <rothorsekid-S0/GAf8tV78@public.gmane.org> wrote:> > > Hello Group. > > I might be misunderstanding, but this does not make sense to me at all. > > > The reason there is a test database in the first place is that it gives > you a reliable state at the beginning of each > TestCase/test/context/spec. To me, this implies that when I do not load > fixtures at all, I get an empty DB (this IS a boundary condition, and I > have to test it). > > Also between different model''s tests, the DB is never cleaned, given I > have no fixtures statements. > > How can I ensure I have a DB that is clean except for the structure in > a TestCase/test/context/spec? Model.delete_all in the setup method? > What if I need my fixtures later in the test case? Model.delete_all in > the test methods themselves? Another test case? This all looks like > workarounds to me. > > I''d be happy to be proven wrong, but this does look like a design error > to me. Wouldn''t it be more concise to just wipe the test DB upon > entering a TestCase/context? > > Regards, > Timm Gebhart > > P.S.: This is my first post to this group. I am a web developer from > Germany, and found RoR to be a perfect match for me about 3 months ago. > So please excuse my ignorance and grammar errors. > > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---