Skip to content

Commit

Permalink
refactored tests -- assert_diffrence instead of checking directly wit…
Browse files Browse the repository at this point in the history
…h count
  • Loading branch information
Karunakar committed Jan 4, 2012
1 parent 40cf126 commit 9a5b335
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions activerecord/test/cases/locking_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,13 @@ def test_update_without_attributes_does_not_only_update_lock_version

def test_polymorphic_destroy_with_dependencies_and_lock_version
car = Car.create!
car.wheels << Wheel.create!
assert_equal 1, car.wheels.count
assert car.destroy
assert_equal 0, car.wheels.count

assert_difference 'car.wheels.count', +1 do
car.wheels << Wheel.create!
end
assert_difference 'car.wheels.count', -1 do
car.destroy
end
assert car.destroyed?
end
end
Expand Down

0 comments on commit 9a5b335

Please sign in to comment.