Rails testing with sqlite

Just a quick note with an answer to an issue which has been bugging me for days.

h3. The problem

Tests run OK within Eclipse but fail miserably from the command line with an error like…

Started
...E
../lib/sqlite3/errors.rb:94:in `check': cannot rollback - no transaction is active (SQLite3::SQLException)

h3. The diagnosis

It seems that the test runner automatically loads fixtures even if not asked to do so. The template fixture files contain stubs for test records which cause sqlite3 to choke.

h3. The solution

Just make sure that fixture files actually contain real fixtures that are needed for your testing!

One Reply to “Rails testing with sqlite”

  1. I know this is an old post but this is the exact problem I was just having, so thank you for posting up your solution! Now I can write tests that run đŸ™‚

Leave a Reply

Your email address will not be published. Required fields are marked *