render_views 在 rspec 中有什么作用? [英] What does render_views do in rspec?

查看:64
本文介绍了render_views 在 rspec 中有什么作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 rspec 的新手,也是 Rails 的新手.在为控制器编写测试用例时,我注意到经常使用 render_views.这有什么作用?如果我不调用它会怎样?

I'm new to rspec and fairly new to rails. When writing test cases for controllers I've noticed render_views used often. What does this do and what happens if I don't call it?

推荐答案

它在控制器规范中呈现视图.如果您不放置 render_views,则视图不会渲染,这意味着控制器被调用,但在它返回后视图不会被渲染.控制器测试将运行得更快,因为它们不必渲染视图,但您可能会错过视图中的错误.

it renders the view's in the controller spec. If you don't put render_views, the views won't render, that means the controller is called but after it returns the views are not rendered. Controller tests will run faster, as they won't have to render the view, but you might miss bugs in the view.

这篇关于render_views 在 rspec 中有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆