I wonder what do you think about testing the validation rules ?
I have written code against simple rules, as validate_presence and so on.
Today, I don't do it anymore, because the "Return on investment" is not relevant for this test code.
(Exception to the rules : I do test my validation methods if they are complexe, like regex)
What do you think : is testing validation rules an anti-pattern ?
I don't know if it's an anti-pattern per se, but it's certainly a waste of time to test the framework -- there's other code testing that those validations work.
The exception would be if you're test driving the behavior of that code, at which point you're not testing validations you're specifying behavior.
Thin line, I guess :)
That's a fairly well contested question, but I fall on the TDD line: I work best when I write tests before each line of code. Basically, it's more about tempo than knowing that I've got 100% test coverage.
So, with that philosophy, I end up writing tests for everything, including the fact that a validation was setup.