开发者

rails controller test: change the default tests or leave them untouched

After scaffolding a new class, rails creates the correspondig tests for each controller method.

What do you think, is best practice in a strikt TDD approach? Is it better, to leave these default tests untouched and to create new tests for each new logic? (Even, if they overlap and verify almost the same things?) Or is it ok to extend these default tests with new assertions?

开发者_如何学运维

TIA, rufus!


Remove the default tests if they don't test stuff you need tested. If you leave them, you're padding your numbers, but the tests won't actually help you in the long run.


Just like with the scaffolding views and controller, you end up replacing most of the default code with your own, it's just a great place to get started.

In general, I would say remove them if you're not using them, or build on them if they can be extended to fit your needs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜