aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/migrator_test.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-01-12 15:29:16 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2012-01-13 14:33:57 -0800
commit01f86cd8ea882bda08071a3e1f5f9e690e83eae9 (patch)
tree6c642e2418f5accc9a7202f29ddb061826140d58 /activerecord/test/cases/migrator_test.rb
parent5baa66cbaded58ba59d23b7df5166746222e92b0 (diff)
downloadrails-01f86cd8ea882bda08071a3e1f5f9e690e83eae9.tar.gz
rails-01f86cd8ea882bda08071a3e1f5f9e690e83eae9.tar.bz2
rails-01f86cd8ea882bda08071a3e1f5f9e690e83eae9.zip
moving migrator tests to a migrator test class
Diffstat (limited to 'activerecord/test/cases/migrator_test.rb')
-rw-r--r--activerecord/test/cases/migrator_test.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/activerecord/test/cases/migrator_test.rb b/activerecord/test/cases/migrator_test.rb
new file mode 100644
index 0000000000..b0d514e50d
--- /dev/null
+++ b/activerecord/test/cases/migrator_test.rb
@@ -0,0 +1,26 @@
+require "cases/helper"
+
+module ActiveRecord
+ class MigratorTest < ActiveRecord::TestCase
+ def test_migrator_with_duplicate_names
+ assert_raises(ActiveRecord::DuplicateMigrationNameError, "Multiple migrations have the name Chunky") do
+ list = [Migration.new('Chunky'), Migration.new('Chunky')]
+ ActiveRecord::Migrator.new(:up, list)
+ end
+ end
+
+ def test_migrator_with_duplicate_versions
+ assert_raises(ActiveRecord::DuplicateMigrationVersionError) do
+ list = [Migration.new('Foo', 1), Migration.new('Bar', 1)]
+ ActiveRecord::Migrator.new(:up, list)
+ end
+ end
+
+ def test_migrator_with_missing_version_numbers
+ assert_raises(ActiveRecord::UnknownMigrationVersionError) do
+ list = [Migration.new('Foo', 1), Migration.new('Bar', 2)]
+ ActiveRecord::Migrator.new(:up, list, 3).run
+ end
+ end
+ end
+end