With recent posts about doing your share to help the Rails community, this post will be interesting for the folks that have yet to set up their Rails testing environment. Why is this a big deal you might ask? Well, if you run through the Rails guide for contributing you will notice that there are quite some steps involved to have a test environment set up. You need to set up postgres, mysql and in some cases even memcached. I’m not even talking about the cases where more exotic databases need to be tested. So this all makes it harder to become one of the selected few. Until now that is.
Not so long ago I came across the awesome Vagrant gem. This gem allows you to easily manage and share environments using Oracle’s VirtualBox. Vagrant is amazing, and the first use case I could think of was building a test box for Rails, which I did. You can find the code for the test box in this repository, the Readme contains all the instructions necessary to get your Rails Test environment up and running, making Rails contributions easy for all! If you want to make a short cut, here is a gist with instructions for the prepackaged version
If you have followed the instructions succesfully, you will be able to log into the Virtualbox and run the tests. You can then find an issue on https://rails.lighthouseapp.com and create a patch in the rails directory which is available in your IDE of choice (the directory is shared with the Virtualbox).
Currently, I have been able to get the suite running on master for 1.8.7, 1.9.1-p376 and Ree, thanks to RVM. I hope to get it working for other rubies as well. On the issue tracker I have listed all the issues that are still open for other Rubies. Most of the issues are “Nice to have” such as Ironruby and Maglev support, but it will take a while before they completely support Rails. JRuby on the other hand is probably already compliant and should be part of the testing environment.
Obviously Rails isn’t the only environment that could use an environment like this. So one of the TODO’s is to extract the Rails parts out of the recipes. Another important TODO is to make installation easier (maybe gemify this repo?). And last but not least some shortcut commands to create and apply patches in git.
If you have ideas or suggestions for improvement. Please comment below, create an issue or go even further and do a patch.
I will use this box to test my Rails patches, but I haven’t done much yet to be honest (So Ryan, please be kind to me ;-))