summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/migrations_helpers.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/support/migrations_helpers.rb b/spec/support/migrations_helpers.rb
index ee17d1a40b7..91fbb4eaf48 100644
--- a/spec/support/migrations_helpers.rb
+++ b/spec/support/migrations_helpers.rb
@@ -11,6 +11,16 @@ module MigrationsHelpers
ActiveRecord::Base.connection.table_exists?(name)
end
+ def migrations
+ ActiveRecord::Migrator.migrations(migrations_paths)
+ end
+
+ def previous_migration
+ migrations.each_cons(2) do |previous, migration|
+ break previous if migration.name == described_class.name
+ end
+ end
+
def migrate!
ActiveRecord::Migrator.up(migrations_paths) do |migration|
migration.name == described_class.name