MySQL transactions not working in unit tests?

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 Parked at Loopia

Any suggestions are much appreciated! (I don’t have enough hair to be
pulling so much out!)

Ed

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

Check that your tables are InnoDB and not MyISAM.

Yep. As I said in the initial post: