aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@plataformatec.com.br>2012-06-10 02:33:14 -0700
committerJosé Valim <jose.valim@plataformatec.com.br>2012-06-10 02:33:14 -0700
commit4845c0685aa3983b4685d4afe141ac5d398521bc (patch)
tree76ad4b6c69694928f8d7aa920e388f19cbbbdf0f /activerecord/test
parentfdcc252e81629eb2d142da32d47037fc5cf4030d (diff)
parentd741a4c6f863778c5ebf04b21f6c3292091c13a7 (diff)
downloadrails-4845c0685aa3983b4685d4afe141ac5d398521bc.tar.gz
rails-4845c0685aa3983b4685d4afe141ac5d398521bc.tar.bz2
rails-4845c0685aa3983b4685d4afe141ac5d398521bc.zip
Merge pull request #6665 from schneems/schneems/raise-migration-error
Notify A User they Have Pending Migrations
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/migration_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb
index fad144ea23..ee02e4ddda 100644
--- a/activerecord/test/cases/migration_test.rb
+++ b/activerecord/test/cases/migration_test.rb
@@ -56,6 +56,21 @@ class MigrationTest < ActiveRecord::TestCase
Person.reset_column_information
end
+ def test_migrator_versions
+ migrations_path = MIGRATIONS_ROOT + "/valid"
+ ActiveRecord::Migrator.migrations_paths = migrations_path
+
+ ActiveRecord::Migrator.up(migrations_path)
+ assert_equal 3, ActiveRecord::Migrator.current_version
+ assert_equal 3, ActiveRecord::Migrator.last_version
+ assert_equal false, ActiveRecord::Migrator.needs_migrations?
+
+ ActiveRecord::Migrator.down(MIGRATIONS_ROOT + "/valid")
+ assert_equal 0, ActiveRecord::Migrator.current_version
+ assert_equal 3, ActiveRecord::Migrator.last_version
+ assert_equal true, ActiveRecord::Migrator.needs_migrations?
+ end
+
def test_create_table_with_force_true_does_not_drop_nonexisting_table
if Person.connection.table_exists?(:testings2)
Person.connection.drop_table :testings2