Should native validations be tested in rails?

前端 未结 5 2617
醉梦人生
醉梦人生 2021-02-20 07:25

Everybody knows that automated testing is a good thing.

Not everybody knows exacly what to test.

My question is if native validations like validate_presence_of,

5条回答
  •  广开言路
    2021-02-20 08:15

    This is where tools like Shoulda really come in handy. I think its totally up to you to test how you write the code with the tools people provide you. Just because you are using has_many, does not mean you are using it right!

    Seriously, if you integrate Shoulda into the mix, it becomes trivial to test these sorts of things. if you run rcov, its going to tell you all the code you wrote is not fully tested, unless you do.

提交回复
热议问题