Permalink
Browse files

refactored tests -- assert_diffrence instead of checking directly wit…

…h count
  • Loading branch information...
1 parent 40cf126 commit 9a5b335d3664ef805f0b1880b709de57ecae1e41 @Karunakar Karunakar committed Jan 4, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 activerecord/test/cases/locking_test.rb
@@ -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

0 comments on commit 9a5b335

Please sign in to comment.