Testing custom rake tasks

So I love testing, but I've only done functional and unit testing via
the built-in suite. The application I'm working on now has a rake file,
but I'm clueless as to how I would test it. I need to create some
records, run the rake, then check these records. I put it in the unit
tests, but it looked ugly and reloading the records gave me an error. So
what is the proper way to do this?

Best practice as I understand it is to include all your task logic in a Rails model and then test that via standard unit testing methods. The code in the actual rake task itself should be limited to handling command line parameters, managing dependencies, and making the call to your model.