diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-01-16 13:58:32 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-01-16 14:02:57 -0800 |
commit | 15daa149b4363575267cbdddd836625dba4ffb44 (patch) | |
tree | e5141f9548d885f1929dbd3de59f328b9b24b5a5 /activerecord/test | |
parent | 8c0c0838cf4675a13964fd944210d66e25014545 (diff) | |
download | rails-15daa149b4363575267cbdddd836625dba4ffb44.tar.gz rails-15daa149b4363575267cbdddd836625dba4ffb44.tar.bz2 rails-15daa149b4363575267cbdddd836625dba4ffb44.zip |
move another migrator to use sensors
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/migration_test.rb | 12 | ||||
-rw-r--r-- | activerecord/test/cases/migrator_test.rb | 18 |
2 files changed, 18 insertions, 12 deletions
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index a2ce6dca3e..dbf8ca319c 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -245,18 +245,6 @@ class MigrationTest < ActiveRecord::TestCase assert names.include?('InnocentJointable') end - def test_target_version_zero_should_run_only_once - # migrate up to 1 - ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid", 1) - - # migrate down to 0 - ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid", 0) - - # migrate down to 0 again - proxies = ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid", 0) - assert_equal [], proxies - end - def test_migrator_db_has_no_schema_migrations_table # Oracle adapter raises error if semicolon is present as last character if current_adapter?(:OracleAdapter) diff --git a/activerecord/test/cases/migrator_test.rb b/activerecord/test/cases/migrator_test.rb index bb507c635a..f7ef5f92d9 100644 --- a/activerecord/test/cases/migrator_test.rb +++ b/activerecord/test/cases/migrator_test.rb @@ -245,6 +245,24 @@ module ActiveRecord assert_equal 0, ActiveRecord::Migration.message_count end + def test_target_version_zero_should_run_only_once + calls, migrations = sensors(3) + + # migrate up to 1 + ActiveRecord::Migrator.new(:up, migrations, 1).migrate + assert_equal [[:up, 0], [:up, 1]], calls + calls.clear + + # migrate down to 0 + ActiveRecord::Migrator.new(:down, migrations, 0).migrate + assert_equal [[:down, 1]], calls + calls.clear + + # migrate down to 0 again + ActiveRecord::Migrator.new(:down, migrations, 0).migrate + assert_equal [], calls + end + private def m(name, version, &block) x = Sensor.new name, version |