From 4d93f8b2a3f430039e0dad4193f61ba4890ba21d Mon Sep 17 00:00:00 2001 From: Thiago Pradi Date: Thu, 8 Jul 2010 03:26:37 -0300 Subject: [PATCH] Tests to specify the behaviour of ActiveRecord::Migrator.get_all_versions() --- activerecord/test/cases/migration_test.rb | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index 4ce9bdb..2c3fc46 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -1358,6 +1358,20 @@ if ActiveRecord::Base.connection.supports_migrations? ActiveRecord::Migrator.forward(MIGRATIONS_ROOT + "/valid") assert_equal(3, ActiveRecord::Migrator.current_version) 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 ActiveRecord::Base.table_name_prefix = "prefix_" -- 1.6.6.1