Directory structure for additional tests

I like to test things besides models, views and controllers.

For example, I’ve got a current project with a significant chunk of
code in the lib directory. Right now I’ve got a test case for it in
the test/integration directory since it feels to me like an
integration test.

I’m curious how others handle this. Do you make a parallel test
directory for lib code? Or fit it into the directories that are
there. If you add directories then do you write additional Rake
tasks?

The reason I’m asking is that I just submitted a patch to autotest
because although it would re-execute my testcase on the lib code if I
modified the testcase, changing the code under test wouldn’t trigger
autotest to test it.

My patch looks for a testcase matching the code file in lib with _test
added in any of test/unit test/functional and test/integration and I
was wondering if this was the right approach in general.