Skip to content

Commit

Permalink
instantiate our own broken migration rather than relying on the files…
Browse files Browse the repository at this point in the history
…ystem
  • Loading branch information
tenderlove committed Jan 13, 2012
1 parent 452195a commit a85625d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
14 changes: 9 additions & 5 deletions activerecord/test/cases/migration_test.rb
Expand Up @@ -879,16 +879,20 @@ def test_migrator_one_up_with_exception_and_rollback
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
Expand Down

This file was deleted.

0 comments on commit a85625d

Please sign in to comment.