Hello, I''m trying to get my Rails test suite to load fixtures in a certain order, but I''m coming across a really strange problem. I have two tables and a join table. Instead of creating the entries for the join table manually, I just go Table1.each do |t1| Table2.each do |t2| ... to create the fields. This only works if Table1 and Table2 are loaded before the join table is loaded. Now, when I go "rake test", it fails on the unit tests that are dependent on the join table having values, but the functional tests that are dependent on them succeed. However, if I go "rake test:functionals", they fail. It seems like the first test suite that gets loaded does not create these entries. Anybody know why this might happen? -- 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-/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 -~----------~----~----~----~------~----~------~--~---
On Oct 20, 6:59 pm, Rob Brit <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hello, I''m trying to get my Rails test suite to load fixtures in a > certain order, but I''m coming across a really strange problem. > > I have two tables and a join table. Instead of creating the entries for > the join table manually, I just go > > Table1.each do |t1| > Table2.each do |t2| > ... >Where is this code been run ? (and to be quite blunt - why?) Fred> to create the fields. This only works if Table1 and Table2 are loaded > before the join table is loaded. > > Now, when I go "rake test", it fails on the unit tests that are > dependent on the join table having values, but the functional tests that > are dependent on them succeed. However, if I go "rake test:functionals", > they fail. It seems like the first test suite that gets loaded does not > create these entries. > > Anybody know why this might happen? > -- > Posted viahttp://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-/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 -~----------~----~----~----~------~----~------~--~---
> Where is this code been run ?It''s being run in the join table''s fixture.> (and to be quite blunt - why?)Because there''s a lot of test data in the other two tables, and typing it out by hand would be big waste of time. Normally the data in the join table is generated by after_save, but since that isn''t called when fixtures are loaded I have to do it this way. -- 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-/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 -~----------~----~----~----~------~----~------~--~---
Actually never mind, I found another solution. -- 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-/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 -~----------~----~----~----~------~----~------~--~---
Great.... what was your other solution?! On Oct 20, 4:39 pm, Rob Brit <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Actually never mind, I found another solution. > -- > Posted viahttp://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-/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 -~----------~----~----~----~------~----~------~--~---