简体   繁体   English

在rails 3和rspec 2中,如何测试对render()的调用所使用的布局?

[英]In rails 3 and rspec 2, how can I test the layout used by a call to render()?

I'm trying to test that a view was rendered with a given layout. 我正在尝试测试视图是否以给定的布局呈现。 How can I test which layout was used for the call to render() ? 如何测试对render()的调用使用了哪种布局?

David Chelimsky在Ruby论坛上发布了一个很好的答案:

response.should render_template("layouts/some_layout")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM