0

I just started using rspec for testing and was wondering whether it was important for each view to have its own test file. I think I would be better off staring with the best practices than realize down the road.

4

1 回答 1

0

除非您不希望对视图进行任何更改,否则我建议您不要对其进行测试。我会考虑的唯一测试是检查视图是否显示了诸如标题之类的重要内容,并且 http 请求响应为 200。

根据我的经验,视图不断变化,每次做一个小改动都会破坏几十个,不值得努力,这是一篇很好的文章,讨论了测试代码某些部分的重要性(底部页面)

于 2013-05-03T19:41:20.633 回答