Saturday, April 25, 2009

This morning I exhumed an old Rails project and started cranking it forward from Rails 1.2.2 to the current version, 2.3.2. That’s about two years of Rails develpopment. This afternoon I got all the tests passing except for two (and I think they’re failing because Yahoo has changed its geocoder)… and then I found the other stash of tests. So, still working on it.

I spent some time tonight sidetracked by tools. In Emacs, thanks to Ryan Davis, I can shift-mouse-3 on pretty much any line in a stack trace and be taken to the right line in the right file. But under Rails 2.3 it doesn’t always work:

I can click on the controller just fine, but I can’t click on the test. See why? For some reason the path is preceded by a slash, so Emacs assumes it’s an absolute path, and looks for a test directory at the root of my filesystem. Does not find.

I didn’t see this at first, so I spent some time digging through ffap.el (find-file-at-point), and then digging through Test::Unit (which was fine), and then I narrowed it down to the filters Rails installs to remove noise from test output. And finally to this commit, which transforms a relative path into an absolute one, “so the backtrace align perfectly”.

I don’t know what that means, but it broke my convenient clicking! Fortunately it broke vim, too, which was what made Cezary Baginski submit a patch that fixes this and removes rspec noise from backtraces as well. So, I’m just posting this to make the solution a little easier to google.