Skip to content
Matijs van Zuijlen edited this page Feb 23, 2016 · 6 revisions

This is the wiki for memory_test_fix.

Recently asked questions

schema.rb vs. migrations

Should you use schema.rb or the migrations to initialize the in-memory database? schema.rb is the default and generally faster. Reasons for using migrate: true could be to help make sure your migrations don't break due to changes in the code elsewhere (whether this is useful depends on your use-case), or to make some seeding data be available. If those reasons don't apply, keeping it at the default is probably faster.

TL;DR: Use the default unless there's a clear reason not to. You can always switch later.

(adapted from issue #2)

Use in production or development

This gem is really for testing, but you could activate it in your production or development environment. You would probably need to hook in to ActiveRecord::Base.establish_connection and call MemoryTestFix::SchemaLoader.init_schema there. Be aware that each connection will have its own set of data.

(adapted from issue #4)

History

Original idea and code: In memory sqlite database for rails testing by Chris Roos

Rails Plugin: San Francisco, Sqlite3 :memory: Tests, Asteroids (link no longer active) by topfunky.

Made into a GemPlugin by Matijs van Zuijlen