The point is that you test that your model is using the validation. I agree with you, though, that your example tests">tests the validation itself, and the test is also somewhat ambiguous.
If you are using the shoulda gem, you can simply use should validate_presence_of(:name)
.
manpreet
Best Answer
2 years ago
There's many examples of testing RoR model validations. Even keeping the test being DRY across multiple models. But isn't it testing Rails which is already tested?
Isn't it testing if Rails validations work?