testing with code injection

Most of my unit tests are too long and repetative, so I'm trying to
refactor them with some code injection.

What I want to do is something like in category_test:

def setup
  @valid_values = {:name => ["frank", "bob, "vfdsnj543543"]}
  @invalid_values = {:name => ["", nil, "some absurdely long name that
won't fit in the db"]}
end

I'm struggling to find a way to inject the necessary methods to test
all the possiblities. Doing anything with the base TestCase has
undesireable results.

I'd like know what other people have done to achieve this sort of
functionality?

Look over heckle (http://seattlerb.rubyforge.org/heckle/).