mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Tests to specify the behaviour of ActiveRecord::Migrator.get_all_versions() [#5066 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
parent
4a26a292a0
commit
8b2330ebc3
1 changed files with 14 additions and 0 deletions
|
@ -1358,6 +1358,20 @@ if ActiveRecord::Base.connection.supports_migrations?
|
||||||
ActiveRecord::Migrator.forward(MIGRATIONS_ROOT + "/valid")
|
ActiveRecord::Migrator.forward(MIGRATIONS_ROOT + "/valid")
|
||||||
assert_equal(3, ActiveRecord::Migrator.current_version)
|
assert_equal(3, ActiveRecord::Migrator.current_version)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_get_all_versions
|
||||||
|
ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid")
|
||||||
|
assert_equal([1,2,3], ActiveRecord::Migrator.get_all_versions)
|
||||||
|
|
||||||
|
ActiveRecord::Migrator.rollback(MIGRATIONS_ROOT + "/valid")
|
||||||
|
assert_equal([1,2], ActiveRecord::Migrator.get_all_versions)
|
||||||
|
|
||||||
|
ActiveRecord::Migrator.rollback(MIGRATIONS_ROOT + "/valid")
|
||||||
|
assert_equal([1], ActiveRecord::Migrator.get_all_versions)
|
||||||
|
|
||||||
|
ActiveRecord::Migrator.rollback(MIGRATIONS_ROOT + "/valid")
|
||||||
|
assert_equal([], ActiveRecord::Migrator.get_all_versions)
|
||||||
|
end
|
||||||
|
|
||||||
def test_schema_migrations_table_name
|
def test_schema_migrations_table_name
|
||||||
ActiveRecord::Base.table_name_prefix = "prefix_"
|
ActiveRecord::Base.table_name_prefix = "prefix_"
|
||||||
|
|
Loading…
Reference in a new issue