Rails em memória sql db

database.yml:

test:
adapter
: sqlite3
database
: ":memory:"

no final de spec / spec_helper.rb:

def in_memory_database?
Rails.env.test? and Rails.configuration.database_configuration['test']['database'] == ':memory:'
end

if in_memory_database?
puts
"creating sqlite in memory database"
silence_stream
(STDOUT) do
load
"#{Rails.root}/db/schema.rb"
end
end