Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
7 lines (6 sloc) 1.75 KB
---
timestamp: 2006-03-01 10:29:41
title: quicker rails testing
tags: projects, rails
id: 35
content: "<p>So, I've finally gotten into the habit of doing serious unit testing at work. We have an agreement not to check in any new code unless the tests all pass, but running all the tests can take a while. (It doesn't help that they run on my 1 GHz personal server.)</p> <p>Anyhow, what's really important in this case is that you test the changes you made. Running every test isn't necessary. You can manually do this by specifying the test file directly, but you may not remember which files you've changed. That's where <kbd>rake since_checkin</kbd> comes in.</p> <p>Behold, <a href='http://dev.rubyonrails.org/ticket/4035'>Ticket 4035</a>, my first code contribution to Rails. In true Rails style, I wrote it <a href='http://jamis.jamisbuck.org/articles/2006/01/27/wait-until-it-hurts'>because I was annoyed</a> with how things were working. This will use <kbd>svn status</kbd> to determine which files have changed, pick the models from that list, and run the tests associated with them. (In fact if you look at the patch, it's really only three lines of new code, and they line up perfectly with the three steps I just listed. I like to think the fact that it's done in three lines of code says more about the expressiveness of Ruby than it does about the content of my patch.)</p> <p>If you want to use the task without upgrading to Edge Rails, just drop <a href='/code/since_checkin.rake'>this file</a> into <kbd>RAILS_ROOT/lib/tasks</kbd>. </p> <p>It's good to be a (minor) contributor. <b>Update</b>: David <a href ='http://dev.rubyonrails.org/changeset/3733'>accepted the patch</a>. He's fast. <b>Update again</b>: name was changed to <kbd>rake uncommitted</kbd>.</p> "