I just installed acts_as_authenticated into an app and one of its unit tests is failing. The cause is that another unit test''s changes to the AAA fixtures aren''t being rolled back. I''m confused, since I have transactional fixtures turned on and MySQL InnoDB engine being used. Details: - MySQL 5.0.24. InnoDB is the default engine, all tables in the test db are using the InnoDB engine. - Stock AAA unit tests. - The unit test in question, test_should_reset_password, succeeds when run by itself, fails when run with all of the unit tests. (I''m using autotest, so when I touch the unit test file, I see the test succeed in isolation, then the same test fails when run with all of the tests.) - test.log clearly shows the unit tests being wrapped in BEGIN/ ROLLBACK pairs - If I modify the other unit test, test_should_not_rehash_password, to explicitly undo the db changes it does, all tests pass, in isolation and collectively. - I have slightly modified AAA''s User model, but I can''t see how the modifications could come into play in this case. (This is integrating into a legacy database with some different conventions.) Code at http://pastie.caboo.se/128208 Any suggestions are much appreciated! (I don''t have enough hair to be pulling so much out!) Ed --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
BTW, turning off transactional fixtures in test_helper.rb results in all AAA tests passing. Turn back on, they fail. For now, that''s my workaround. Slower tests, but they work as I expect them to. Ed --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Aleksandr.Lossenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Dec-26 10:20 UTC
Re: MySQL transactions not working in unit tests?
Check that your tables are InnoDB and not MyISAM. On Dec 19, 12:55 am, ed_ruder <ed.ru...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> BTW, turning off transactional fixtures in test_helper.rb results in > all AAA tests passing. Turn back on, they fail. For now, that''s my > workaround. Slower tests, but they work as I expect them to. > > Ed--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Yep. As I said in the initial post:>Details: >- MySQL 5.0.24. InnoDB is the default engine, all tables in the test >db are using the InnoDB engine.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---