With Rails 2.3.x there was a rake task "rake db:test:clone" that I used to use all the time in order to clone the development DB for use with testing. However I can''t seem to find that test with Rails 3.0. How is everyone bootstrapping their test database etc. for testing? -- 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.
Alex wrote:> With Rails 2.3.x there was a rake task "rake db:test:clone" that I > used to use all the time in order to clone the development DB for use > with testing. > > However I can''t seem to find that test with Rails 3.0. How is > everyone bootstrapping their test database etc. for testing?You don''t want to do that. Start from a blank DB, and in each test, use factories to create only the records you need for that test. That way it is clearer what is being tested. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org Sent from my iPhone -- Posted via http://www.ruby-forum.com/. -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Oct 8, 2:22 pm, Marnen Laibow-Koser <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> You don''t want to do that. Start from a blank DB, and in each test, use > factories to create only the records you need for that test. That way > it is clearer what is being tested.Except for the dictionaries tables. I changed the rake tasks so development and test database are both seeded. Robert Pankowecki -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 8 October 2010 13:22, Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Alex wrote: >> With Rails 2.3.x there was a rake task "rake db:test:clone" that I >> used to use all the time in order to clone the development DB for use >> with testing. >> >> However I can''t seem to find that test with Rails 3.0. How is >> everyone bootstrapping their test database etc. for testing? > > You don''t want to do that. Start from a blank DB, and in each test, use > factories to create only the records you need for that test. That way > it is clearer what is being tested.I did not think that rake db:test:clone cloned the db contents, I thought it was just the structure, that is certainly what happened when I tried it (expecting it to clone the data). Though what the difference is between db:test:clone, db:test:clone_structure and db:test:prepare I am not sure. If I am right then I think the OP is asking how to create his test db in Rails 3, in other words the equivalent of db:test:prepare. Colin -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Robert Pankowecki wrote:> On Oct 8, 2:22�pm, Marnen Laibow-Koser <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > >> You don''t want to do that. �Start from a blank DB, and in each test, use >> factories to create only the records you need for that test. �That way >> it is clearer what is being tested. > > Except for the dictionaries tables. I changed the rake tasks so > development and test database are both seeded. >No. Even dictionaries should not be seeded in test. Just use factories to create only the actual records needed for each individual test. As far as I can tell, there is no valid use case for seeding the test DB. Don''t ever do it.> Robert PankoweckiBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org Sent from my iPhone -- Posted via http://www.ruby-forum.com/. -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Oct 10, 7:29 am, Marnen Laibow-Koser <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> No. Even dictionaries should not be seeded in test. Just use factories > to create only the actual records needed for each individual test.I can''t agree. Try to convince me. Having all the dictionaries seeded once at the start makes my tests shorter and faster. Robert Pankowecki -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Robert Pankowecki wrote:> On Oct 10, 7:29�am, Marnen Laibow-Koser <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> No. �Even dictionaries should not be seeded in test. �Just use factories >> to create only the actual records needed for each individual test. > > I can''t agree. Try to convince me. Having all the dictionaries seeded > once at the start makes my tests shorter and faster.It does not make them faster, because you''re loading lots of unnecessary records. Anyway, who cares who fast your tests are if they''re wrong? You can''t know that you''re actually testing what you think you are, unless you start each test from a blank slate and create only a restricted set of records (generally no more than 10 if your tests are of the proper granularity). Preloading the DB is cheating at solitaire.> > Robert PankoweckiBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org Sent from my iPhone -- Posted via http://www.ruby-forum.com/. -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.