You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
I want this as well and might put a little work into it. My template goes a little further adding the special sauce necessary to keep the test quiet, and handy subject lines.
require "rails_helper"
require Rails.root.join("db", "data", "20200701180749_add_this_to_that")
describe AddThisToThat do
let(:migrator) {
described_class.new.tap do |m|
m.verbose = false
end
}
describe "#up" do
subject { migrator.migrate(:up) }
pending "Needs tests"
end
describe "#down" do
subject { migrator.migrate(:down) }
pending "Needs tests"
end
end
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:
The text was updated successfully, but these errors were encountered: