How to use in-memory SQLite database for Rails testing

17 Apr 2010 | Rails

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

Let's view how to use SQLite to store your test database and reduce considerably the time needed to run all your tests.

First of all we need to install memory_test_fix plugin

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

and now you can configure your test database

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

Now try to run your tests... ;)

blog comments powered by Disqus