Displaying 1 result from an estimated 1 matches for "zimps".
Did you mean:
pimps
2006 Mar 01
1
maddening intermittent failures in unit tests with "working" code
...''s almost as though there is a race condition somewhere, or an unreliable
SQL transaction.
def reservations
# called by User object, returns count of reservations with associated Zimp
objects
# Zimp and User are AR classes mapped to MySQL schema shown later below.
count = 0
self.zimps.each { |x| count += x.reserved.to_i }
count
end
A typical unit test for this function would be to create a User object and
call the function, and check the return result
def test_working
@user=User.find(:first)
assert_equal 2, @user.reservations
end
For the test data loaded from the fixt...