From 21946036780245f05283f0572f90ade0d5423dfd Mon Sep 17 00:00:00 2001 From: rohit Date: Thu, 8 Jul 2010 19:21:05 +0530 Subject: [PATCH] Tests for ActiveRecord::Migrator.get_all_versions() [#5066 state:commited] --- activerecord/test/cases/migration_test.rb | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index 4ce9bdb..ad7cd4d 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -1359,6 +1359,28 @@ if ActiveRecord::Base.connection.supports_migrations? 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) + end + + def test_get_all_versions_after_rollback + ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid") + ActiveRecord::Migrator.rollback(MIGRATIONS_ROOT + "/valid") + + assert_equal([1,2], ActiveRecord::Migrator.get_all_versions) + end + + def test_get_all_versions_forward + ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid", 1) + assert_equal([1], ActiveRecord::Migrator.get_all_versions) + end + + def test_get_all_versions_no_migration + ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid", 0) + assert_equal([], ActiveRecord::Migrator.get_all_versions) + end + def test_schema_migrations_table_name ActiveRecord::Base.table_name_prefix = "prefix_" ActiveRecord::Base.table_name_suffix = "_suffix" -- 1.7.0.4