A little less lazy for me, a little more for you

March 29, 2008 – 11:20 am

What with the new baby and all, finding time for coding has been a little tricky. Nevertheless, I have eked out a few moments here and there to continue working on laziness (which Matz mentioned on his blog!). The first version of the plugin is cool, but the tests it generates are really the least specific ones possible. The update (that I just pushed to GitHub and SVN this morning) is a step in the direction of fixing that. With the new version, you can define custom tests to be generated for particular exceptions. For example, if ActionController::UnknownAction is thrown when someone hits http://yoursite/users/cool, laziness will now generate the following test:

def test_userscontroller_should_have_the_action_cool
assert UsersController.action_methods.include?('cool')
end

Right now, ActionController::UnknownAction is the only custom exception the plugin handles out of the box - all others get the same old general test. I’m excited by the success of my proof-of-concept here, though, so I’m going to work on adding more specific handlers over time. And as always, I welcome contributions - just fork the repo at GitHub and go to town! (And if you still don’t have a GitHub account, email scofield at this domain and I’ll do my best to hook you up - I still have a few invites left.)

Post a Comment