Actions
Refactor #11618
closedReplace validation tests by shoulda-matchers
Description
A good chunk of our unit tests are testing whether a validation is working or not by testing it actively. For the validations we've added ourselves I would say it's fine. However for validations that come from the Rails framework, we're essentially testing their job. Instead of testing (for instance) validates(:name, :uniqueness => true) by creating two objects and verifying the second one won't save (these tests are already done at the framework level), we should simply test we're including validations in our models.
The well-maintained gem shoulda-matchers provide easy functions to check we're including such validations, and other helpers we can use to refactor our tests further and not test Rails functionality twice.
Actions