aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-01-11 14:53:37 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2012-01-13 14:33:53 -0800
commita85625dacfe7782148f7566c199d562c8acb71c0 (patch)
treeb08f2eef9d9630fe3ea70af84ec48a38aafd0a07 /activerecord/test/cases
parent452195af2c9c0502e73ca1ba48d7e6bda071c2ac (diff)
downloadrails-a85625dacfe7782148f7566c199d562c8acb71c0.tar.gz
rails-a85625dacfe7782148f7566c199d562c8acb71c0.tar.bz2
rails-a85625dacfe7782148f7566c199d562c8acb71c0.zip
instantiate our own broken migration rather than relying on the filesystem
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/migration_test.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb
index fc26e9527d..15677d80a0 100644
--- a/activerecord/test/cases/migration_test.rb
+++ b/activerecord/test/cases/migration_test.rb
@@ -879,16 +879,20 @@ class MigrationTest < ActiveRecord::TestCase
skip "not supported on #{ActiveRecord::Base.connection.class}"
end
- assert !Person.column_methods_hash.include?(:last_name)
+ refute Person.column_methods_hash.include?(:last_name)
- e = assert_raise(StandardError) do
- ActiveRecord::Migrator.up(MIGRATIONS_ROOT + "/broken", 100)
- end
+ migration = Struct.new(:name, :version) {
+ def migrate(x); raise 'Something broke'; end
+ }.new('zomg', 100)
+
+ migrator = ActiveRecord::Migrator.new(:up, [migration], 100)
+
+ e = assert_raise(StandardError) { migrator.migrate }
assert_equal "An error has occurred, this and all later migrations canceled:\n\nSomething broke", e.message
Person.reset_column_information
- assert !Person.column_methods_hash.include?(:last_name)
+ refute Person.column_methods_hash.include?(:last_name)
end
def test_finds_migrations