渲染内联的Rspec:location.reload

时间:2017-01-24 07:41:09

标签: ruby-on-rails ruby rspec

我的控制器最后有以下内容

** 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编写RSPEC吗?

1 个答案:

答案 0 :(得分:0)

感谢您的回复,我知道我们应该指定xhr而不是get/post :method 所以这就行了,

xhr :post, :schedule_message, params, format: :js
expect(response.body).to eq "location.reload();"
相关问题