Brian
2008-Jun-05 20:55 UTC
what is proper way to load lookup/reference data into test database?
I''m just getting into writing tests for my first RoR app. I''ve got a few data migrations to load reference data (i.e. 2-char state abbrevs, payment types, etc.). How do I get that data into the test database? I understand fixtures are to load test data. But if I duplicate these lookup tables in test fixtures, it seems like that is violating the DRY principle. Is that OK in this case? Or do I run the data-only migrations into the test database somehow? --~--~---------~--~----~------------~-------~--~----~ 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
2008-Jun-06 12:58 UTC
Re: what is proper way to load lookup/reference data into test database?
just bumping in the morning for an answer On Jun 5, 4:55 pm, Brian <brifo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m just getting into writing tests for my first RoR app. I''ve got a > few data migrations to load reference data (i.e. 2-char state abbrevs, > payment types, etc.). How do I get that data into the test database? > I understand fixtures are to load test data. But if I duplicate these > lookup tables in test fixtures, it seems like that is violating the > DRY principle. Is that OK in this case? Or do I run the data-only > migrations into the test database somehow?--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
sullivan.t
2008-Jun-06 13:31 UTC
Re: what is proper way to load lookup/reference data into test database?
I believe there is a rake command to load fixtures into test and other environments. However, I don''t know it. :P On Jun 5, 4:55 pm, Brian <brifo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m just getting into writing tests for my first RoR app. I''ve got a > few data migrations to load reference data (i.e. 2-char state abbrevs, > payment types, etc.). How do I get that data into the test database? > I understand fixtures are to load test data. But if I duplicate these > lookup tables in test fixtures, it seems like that is violating the > DRY principle. Is that OK in this case? Or do I run the data-only > migrations into the test database somehow?--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Brian
2008-Jun-06 14:01 UTC
Re: what is proper way to load lookup/reference data into test database?
I''ve only done a Unit Test so far, but I specified the fixtures to load in that test case. I also ran rake db:test:prepare command, but that only loaded the schema from dev, but not the data. I duplicated the data in my fixtures just to move forward, but I''m still wondering if that was the right thing to do. The question was whether or not to duplicate the reference data in the fixture On Jun 6, 9:31 am, "sullivan.t" <sulliva...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I believe there is a rake command to load fixtures into test and other > environments. However, I don''t know it. :P > > On Jun 5, 4:55 pm, Brian <brifo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I''m just getting into writing tests for my first RoR app. I''ve got a > > few data migrations to load reference data (i.e. 2-char state abbrevs, > > payment types, etc.). How do I get that data into the test database? > > I understand fixtures are to load test data. But if I duplicate these > > lookup tables in test fixtures, it seems like that is violating the > > DRY principle. Is that OK in this case? Or do I run the data-only > > migrations into the test database somehow?--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---