class Object
Public Instance Methods
all_migrations(path)
click to toggle source
# File lib/migration_data/testing.rb, line 17 def all_migrations(path) if Rails::VERSION::MAJOR >= 5 && Rails::VERSION::MINOR >= 2 ActiveRecord::MigrationContext.new(path).migrations elsif Rails::VERSION::MAJOR > 5 ActiveRecord::MigrationContext.new(path, nil).migrations else ActiveRecord::Migrator.migrations(path) end end
require_migration(migration_name)
click to toggle source
# File lib/migration_data/testing.rb, line 3 def require_migration(migration_name) path = MigrationData::ActiveRecord::Migration.migration_dir migrations = all_migrations(path) migration_name += '.rb' unless migration_name.end_with?('.rb') file = migrations.detect do |m| m.filename.end_with?(migration_name) end raise LoadError, "cannot load such file -- #{migration_name}" unless file require Rails.root.join(file.filename) end