Namespace
Methods
T
Instance Public methods
teardown()
# File activerecord/test/cases/invertible_migration_test.rb, line 43
def teardown
  if ActiveRecord::Base.connection.table_exists?("horses")
    ActiveRecord::Base.connection.drop_table("horses")
  end
end
test_down()
# File activerecord/test/cases/invertible_migration_test.rb, line 86
def test_down
  LegacyMigration.up
  LegacyMigration.down
  assert !ActiveRecord::Base.connection.table_exists?("horses"), "horses should not exist"
end
test_legacy_down()
# File activerecord/test/cases/invertible_migration_test.rb, line 75
def test_legacy_down
  LegacyMigration.migrate :up
  LegacyMigration.migrate :down
  assert !ActiveRecord::Base.connection.table_exists?("horses"), "horses should not exist"
end
test_legacy_up()
# File activerecord/test/cases/invertible_migration_test.rb, line 70
def test_legacy_up
  LegacyMigration.migrate :up
  assert ActiveRecord::Base.connection.table_exists?("horses"), "horses should exist"
end
test_migrate_down()
# File activerecord/test/cases/invertible_migration_test.rb, line 63
def test_migrate_down
  migration = InvertibleMigration.new
  migration.migrate :up
  migration.migrate :down
  assert !migration.connection.table_exists?("horses")
end
test_migrate_down_with_table_name_prefix()
# File activerecord/test/cases/invertible_migration_test.rb, line 92
def test_migrate_down_with_table_name_prefix
  ActiveRecord::Base.table_name_prefix = 'p_'
  ActiveRecord::Base.table_name_suffix = '_s'
  migration = InvertibleMigration.new
  migration.migrate(:up)
  assert_nothing_raised { migration.migrate(:down) }
  assert !ActiveRecord::Base.connection.table_exists?("p_horses_s"), "p_horses_s should not exist"
ensure
  ActiveRecord::Base.table_name_prefix = ActiveRecord::Base.table_name_suffix = ''
end
test_migrate_up()
# File activerecord/test/cases/invertible_migration_test.rb, line 57
def test_migrate_up
  migration = InvertibleMigration.new
  migration.migrate(:up)
  assert migration.connection.table_exists?("horses"), "horses should exist"
end
test_no_reverse()
# File activerecord/test/cases/invertible_migration_test.rb, line 49
def test_no_reverse
  migration = NonInvertibleMigration.new
  migration.migrate(:up)
  assert_raises(IrreversibleMigration) do
    migration.migrate(:down)
  end
end
test_up()
# File activerecord/test/cases/invertible_migration_test.rb, line 81
def test_up
  LegacyMigration.up
  assert ActiveRecord::Base.connection.table_exists?("horses"), "horses should exist"
end