data-migrate icon indicating copy to clipboard operation
data-migrate copied to clipboard

feature: Generate a spec file.

Open schwern opened this issue 5 years ago • 6 comments

Unlike schema migrations, data migrations are easy to test but require a bit of special setup. This adds a spec file to the generator.

  • Loads the migration.
  • Sets up the a quiet migrator object.
  • Basic describe up/down blocks with subjects.

Closes #148

schwern avatar Dec 15 '20 04:12 schwern

Good idea. However, what about the people who don't use rspec? Maybe there should be an env var or something that is set if you want to generate spec file? I there there is something in Rails itself about this, but don't remember exactly how it works there

ilyakatz avatar Dec 15 '20 06:12 ilyakatz

Rails.configuration.generators.options[:rails] can be introspected to get the test_framework. I'll see about putting something together for minitest.

schwern avatar Dec 15 '20 21:12 schwern

Cool. That's a great idea

On Dec 15, 2020 at 1:44 PM, <Michael G. Schwern (mailto:[email protected])> wrote:

Rails.configuration.generators.options[:rails] can be introspected to get the test_framework. I'll see about putting something together for minitest.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub (https://github.com/ilyakatz/data-migrate/pull/162#issuecomment-745586543), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AACE7EVUHYLYUXPWXJWAT5TSU7KDLANCNFSM4U3XRL2A).

ilyakatz avatar Dec 16 '20 02:12 ilyakatz

@schwern are you still interested in implementing this?

ilyakatz avatar Aug 02 '22 03:08 ilyakatz

will give it a try someday Would be really useful to have that

ngouy avatar Nov 02 '22 13:11 ngouy

@schwern are you still interested in implementing this?

Sure. I'll have to reload it into my brain.

schwern avatar Nov 14 '22 19:11 schwern