Hey Guys, I''ve got a test class that loads a bunch of fixtures. My understanding is that fixtures are reloaded between each test... and I even have the following two method calls at the top of my test class to make doubly sure... class TaskTest < Test::Unit::TestCase self.use_transactional_fixtures = true self.use_instantiated_fixtures = false When I run my tests individually... as in: ruby unit/task_test.rb --name test_update The tests run successfully to completion. However, when I try to run the entire test file in one go, I get failures. As in: ruby unit/task_test.rb> 8) Error: > test_update(TaskTest): > ActiveRecord::RecordNotFound: Couldn''t find Task with ID=2I query the database and the record task.id = 2 is indeed missing. Strangely enough this test file works perfectly on Windows. Anyone have any ideas? I''m guessing there''s an issue with my Linux/Ubuntu mysql adapter... but I''m not sure how to confirm... Any help would be very much appreciated. Sonny. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On Tue, Feb 12, 2008 at 11:38:04PM +0100, Sonny Chee wrote:> I''ve got a test class that loads a bunch of fixtures. My understanding > is that fixtures are reloaded between each test... and I even have the > following two method calls at the top of my test class to make doubly > sure... > > class TaskTest < Test::Unit::TestCase > > self.use_transactional_fixtures = true > self.use_instantiated_fixtures = false > > > When I run my tests individually... as in: > > ruby unit/task_test.rb --name test_update > > The tests run successfully to completion. However, when I try to run the > entire test file in one go, I get failures. As in: > > ruby unit/task_test.rb > > > 8) Error: > > test_update(TaskTest): > > ActiveRecord::RecordNotFound: Couldn''t find Task with ID=2 > > I query the database and the record task.id = 2 is indeed missing. > Strangely enough this test file works perfectly on Windows. > > Anyone have any ideas? I''m guessing there''s an issue with my > Linux/Ubuntu mysql adapter... but I''m not sure how to confirm... Any > help would be very much appreciated.I can''t give you any help, unfortunately, except to note that I''ve observed similar failures on my system, which is Ubuntu also. I haven''t had a chance to chase down WTF is going on, though, and I doubt I''ll be in much of a position to do so in the near future. But at least you know you''re not alone now. <grin> - Matt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On 2/12/08, Sonny Chee <ruby-forum-incoming@andreas-s.net> wrote:> > Hey Guys, > > I''ve got a test class that loads a bunch of fixtures. My understanding > is that fixtures are reloaded between each test... and I even have the > following two method calls at the top of my test class to make doubly > sure... > > class TaskTest < Test::Unit::TestCase > > self.use_transactional_fixtures = true > self.use_instantiated_fixtures = false > > > When I run my tests individually... as in: > > ruby unit/task_test.rb --name test_update > > The tests run successfully to completion. However, when I try to run the > entire test file in one go, I get failures. As in: > > ruby unit/task_test.rb > > > 8) Error: > > test_update(TaskTest): > > ActiveRecord::RecordNotFound: Couldn''t find Task with ID=2 > > I query the database and the record task.id = 2 is indeed missing. > Strangely enough this test file works perfectly on Windows. > > Anyone have any ideas? I''m guessing there''s an issue with my > Linux/Ubuntu mysql adapter... but I''m not sure how to confirm... Any > help would be very much appreciated.This topic is probably better discussed on the general rails-talk forum rather than core, but One thought is to check that you are using a mysql table type which supports transactions. Innodb does, myisam (which is or used to be the default for mysql) does not. Try setting use_transactional_fixtures to fall and see if it makes a difference. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On 2/13/08, Rick DeNatale <rick.denatale@gmail.com> wrote:> Try setting use_transactional_fixtures to fall and see if it makes a difference.s/fall/false/ -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Rick Denatale wrote:> One thought is to check that you are using a mysql table type which > supports transactions. Innodb does, myisam (which is or used to be > the default for mysql) does not. >Awesome, that did the trick. It appears the Debian/Ubuntu release for mySQL 5 has the table type default to myIsam. Sonny. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---