How to use in-memory SQLite database for Rails testing

17 Apr 2010

Contrary to popular belief, SQLite is a great database, and the most important thing.... it's very fast!

Let's see how to use SQLite to store your test database and reduce considerably the time needed to run your test suite.

First of all we need to install the memory_test_fix plugin:

./script/plugin install git://github.com/rsl/memory_test_fix.git

now you can configure your test database:

#/config/database.yml
test:
  adapter: sqlite3
  database: ":memory:"
  verbosity: silent

Now try to run your tests ;)