I’m working on a Gem that contains a migration generator and a bunch of models, classes, etc that utilize the tables created as part of the migration.
Although testing the migration generator itself is easy enough – there’s loads of tutorials around for getting that done, what i’m trying to work out is how to actually run the migration on the test DB so I can later test how the gem interacts with the test data?
Since the gem doesn’t have a schema.rb, I wasn’t sure how to go about doing it.
This is how I run migrations in code;
If you have a string containing your generated migration you could do something like this in your test setup;
That should give you a migrated database using the migration you’ve generated.