提交 9d31acf8 编写于 作者: C Christopher Meiklejohn 提交者: Xavier Noria

Ensure that .up and .down work as well.

上级 9d19bae2
...@@ -54,13 +54,13 @@ def test_no_reverse ...@@ -54,13 +54,13 @@ def test_no_reverse
end end
end end
def test_up def test_migrate_up
migration = InvertibleMigration.new migration = InvertibleMigration.new
migration.migrate(:up) migration.migrate(:up)
assert migration.connection.table_exists?("horses"), "horses should exist" assert migration.connection.table_exists?("horses"), "horses should exist"
end end
def test_down def test_migrate_down
migration = InvertibleMigration.new migration = InvertibleMigration.new
migration.migrate :up migration.migrate :up
migration.migrate :down migration.migrate :down
...@@ -77,5 +77,16 @@ def test_legacy_down ...@@ -77,5 +77,16 @@ def test_legacy_down
LegacyMigration.migrate :down LegacyMigration.migrate :down
assert !ActiveRecord::Base.connection.table_exists?("horses"), "horses should not exist" assert !ActiveRecord::Base.connection.table_exists?("horses"), "horses should not exist"
end end
def test_up
LegacyMigration.up
assert ActiveRecord::Base.connection.table_exists?("horses"), "horses should exist"
end
def test_down
LegacyMigration.up
LegacyMigration.down
assert !ActiveRecord::Base.connection.table_exists?("horses"), "horses should not exist"
end
end end
end end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册