rails/rails — Issue #3370: Mountable engine generator - not friendly to outside testing utilities.
Author: johncburr
Created: 2011-10-19 18:47:27+00:00
State: open

When generating a mountable engine using:

rails plugin new foo --mountable

The dummy app is created within the test directory. But if a user wishes to use some other testing mechanism, such as rspec, the natural inclination is to modify the generation command thus:

rails plugin new foo --mountable -T

Unfortunately, the only thing this seems to do skip creating the test directory altogether, but all of the references to the dummy app, that would have been present in the test directory had you not chosen that option, still exist. Voila, train wreck.

Wouldn't it be better to give the dummy app its own separate directory outside of the test directory so that everything works regardless of how you want to test?

Also, because the rails script in the dummy app is needed to run any rails commands within the engine, rails doesn't work if you used the -T option to create the engine. Bummer, because it is nice to be able to do stuff like:

rails generate model bar

or:

rails console

...and so forth without being forced to endure the "clunkiness" of unit testing.

Yes, one can manually go through and re-write everything so that it works properly, but doesn't that defeat the purpose of a generator? It would be nice if the mountable engine generator weren't quite so biased.