Refactor Rails::Generator::TestCase into modules

Break down Rails::Generator::TestCase functionality into modules so it can be easily reused by alternative testing frameworks.