13. Truth
• BDD — Body Dysmorphic Disorder
• TDD — Test Driven Development
• CI — Convergence insufficiency
• ADD — Attention Deficit Disorder
• DDD — DDD
14. Testing limitations
• We can’t test everything
• You can’t develop an algorithm to proof
that your program is correct
• Testing is hard
• Tests have errors
• Not that effective at finding bugs
15. Race conditions
• Most developers don’t think about race
conditions
• Validates uniqueness is not race conditions
safe
• Some gems are not race conditions safe
and it is your business to check them
16. Optimistic locking
• Each update to the record increments the
lock_version column and the locking
facilities ensure that the records
instantiated twice will let the last one saved
raise a StaleObjectError if the first was also
updated
• Doesn’t work between actions like edit/
update
17. Pessimistic locking
• SELECT FOR UPDATE
• FOR UPDATE causes the rows retrieved
for by the SELECT statement to be locked
as thought for update. This prevents them
from being modified or deleted by other
transactions until the current transaction
ends
20. Test on race conditions
• It is hard to find them and there is no tool
for that
• You can use test hooks in your production
code for testing them in your rspec