This is Part 3 of the preview for "Keeping Tests Dry" at next week's erubycon.
Several people have commented with improvements to the code shown in Part 1 and Part 2. I will respond to some of these in the final installment, but first this: What if you could declare validation tests, just like you declare the validations themselves?
This is nice and DRY: all future arguments about exactly what to assert, or why, can be settled in one place--the body of the validates_presence_of method. Here is a possible implementation:
How would you improve this method? (More to follow...)
We are a collection of experienced, thoughtful technologists, passionate about helping organizations deploy
technology effectively and humanely to build better futures. We like to work with you on the hard stuff.