refactored tests -- assert_diffrence instead of checking directly with count

This commit is contained in:
Karunakar (Ruby) 2012-01-04 20:41:07 +05:30
parent 40cf126907
commit 9a5b335d36

@ -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