Engine testing

Dear core team,

I love the new approach to engines (Railties), and how they can be packaged as gems!

I was tempted to re-factor a lot of code into engines, and then I stumbled upon the problem of testing. The Rails guide on plugins shows a bunch of code that I have to copy-paste to setup a Rails-like environment in my tests. Also, I haven't seen instructions on testing the Railtie yet. This makes me unhappy, because copy-pasting the code everywhere is non-DRY, and I don't have test coverage to make sure the API doesn't change.

I ended up generating a new Rails application that includes my plugin (gem 'plugin', :path => '../plugin'), and doing tests there. I'm wondering if (1) it's acceptable to say that the tests for my plug-in actually live in a separate Rails app (2) there are "integration" tests for plug-ins

Ideally, (2) would be solved as follows: an "engine" generator would create the plugin structure (bonus points for including code for a Railtie), and would set up the Rakefile so that instead of having a /test folder, I'd have a /testapp folder which would contain a Rails application. /testapp would only have /app /db and /test in it. The configuration would be setup to be the default configuration, and the Bundler configuration would only include Rails, the gem I'm writing, and its development dependencies. I'd probably want most of my migrations to be based off my generators, so it'd be nice to be able to say "run this generator with these arguments" in the test setup, and have that reverted in teardown.

I'm hoping I'm not the only person bothered by this testing issue, and that there is a solution out there already. If that's not the case, would someone be able to help me build one? I'd like to have the blessing of the Rails core team, and to get help figuring out exactly where to hook into Rails to get this done.

Thank you, Victor