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