Toxic Elephant

Don't bury it in your back yard!

Gem for memory_test_fix

Posted by matijs 27/06/2010 at 21h10

In some of my Rails projects, I have been a contented user of the memory_test_fix plugin. However, I rather dislike the use of Rails plugins, because I find updating them later on rather difficult, and I don’t like including external libraries in my own source tree (hence, I don’t like the practice of vendoring gems much either). When the concept of ‘gem plugins’ was introduced, I created a fork on github and created the necessary files to build the plugin as a gem, and have Rails properly load it.

Somehow I never got around to seeing if all this actually worked. However, recently I revisited an old project that I never quite finished, updated it to Rails 2.3.8, and decided to try replacing the memory_test_fix plugin code it included with a simple call to config.gem. It worked fine.

After incorporating a patch to allow the use of in-memory databases for any environment (use for development and production is of course not recommended), the gem is now at version 0.1.3, and has been pushed to gemcutter.

From the README:

Install the gem:

gem install memory_test_fix

In your config/environments.rb, use:

config.gem 'memory_test_fix'

In your database.yml, use:

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

It runs much faster!

This makes me the official maintainer of this gem, which may not be ideal in the long run, since I’m not really the main author of this code. Feel free to ask me for access or to contact me to discuss other options.

Tags no comments no trackbacks

Comments

Comments are disabled