Echographia

making things better, making better things

Saturday, April 25, 2009

Rails 2.3 backtraces and emacs

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:

 24) Error:
test_search_by_location(VenuesControllerTest):
NameError: uninitialized constant VenuesController::Paginator
    app/controllers/venues_controller.rb:39:in `search'
    /test/functional/venues_controller_test.rb:372:in `test_search_by_location'

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.

posted by erik at 9:54 pm  

1 Comment

  1. [...] happened, see, was that I finally started using my aforementioned old Rails app in earnest, and when I did, I discovered that… I couldn’t log out. I [...]

    Pingback by Echographia » Why I switched from acts_as_authenticated to Clearance, and why I didn’t need to — May 23, 2009 @ 4:02 pm

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress