Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix up test altering global state that was causing me grief

  • Loading branch information...
commit 47b97a739d5588cfa439a4805fb1ddd3b7a7acbe 1 parent 3a40d38
@jonleighton jonleighton authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 activerecord/test/cases/locking_test.rb
View
6 activerecord/test/cases/locking_test.rb
@@ -320,6 +320,8 @@ def test_destroy_dependents
assert_equal true, p1.frozen?
assert_raises(ActiveRecord::RecordNotFound) { Person.find(p1.id) }
assert_raises(ActiveRecord::RecordNotFound) { LegacyThing.find(t.id) }
+ ensure
+ remove_counter_column_from(Person, 'legacy_things_count')
end
private
@@ -331,8 +333,8 @@ def add_counter_column_to(model, col='test_count')
model.update_all(col => 0) if current_adapter?(:OpenBaseAdapter)
end
- def remove_counter_column_from(model)
- model.connection.remove_column model.table_name, :test_count
+ def remove_counter_column_from(model, col = :test_count)
+ model.connection.remove_column model.table_name, col
model.reset_column_information
end
Please sign in to comment.
Something went wrong with that request. Please try again.