WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Generate a spec file when a data_migration is generated #148

@bgwilson87

Description

@bgwilson87

Hi there, I'm migrating from an old gem called datafix https://github.com/dimroc/datafix

It has a nice feature where it generates a spec file for you when you generate a data migration. With complicated data migrations, I find it's best to write some tests to make sure the data migration is doing what I expect. Do you think this is something you could support?

For example
rails g data_migration add_this_to_that

would generate a spec file in addition to the migration file at this location
spec/db/data/20200701180749_add_this_to_that_spec.rb

with this content:

require "rails_helper"
require Rails.root.join("db", "data", "20200701180749_add_this_to_that")

describe AddThisToThat do
  describe ".up" do
    pending "Needs tests"
  end

  describe ".down" do
    pending "Needs tests"
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions