0
我有以下的末我控制器Rspec的渲染为直列:location.reload
** some code **
respond_to do |format|
format.js {render inline: "location.reload();" }
end
我不得不写相同的RSPEC
。
expect(response).to render_template(:**what should be given here?**)
或者是否还有其他方法来编写RSPEC?
的可能的复制http://stackoverflow.com/questions/10908547/rspec -rendering-text – 31piy
是的,我发现这个问题之前检查,但没有得到任何想法实现它到我的代码。 –
链接的帖子中的答案告诉你到底你需要知道什么。如果你看一下'response.body',你会得到响应的主体。那就是,标题之后的所有内容。所以在你的情况下,你会得到'location.reload();'作为响应字符串,你可以比较。 – mroach