One of the things I will look at in "Keeping Tests Dry" at next week's erubycon is various ways people test ActiveRecord validations.
Here's one bad idea:
def test_contact_requires_name c = Contact.new err = assert_raise(ActiveRecord::RecordInvalid) { c.save! } assert_equal "Validation failed: Name can't be blank", err.message end
What's wrong with this example? (More to follow...)
random
recent