Ruby on rails 如何测试render_remote_内容是否接收正确的局部变量
在控制器规范中,我尝试测试调用render_remote_content的控制器操作是否使用正确的 目前,我正在尝试做如下工作:Ruby on rails 如何测试render_remote_内容是否接收正确的局部变量,ruby-on-rails,rspec2,rspec-rails,Ruby On Rails,Rspec2,Rspec Rails,在控制器规范中,我尝试测试调用render_remote_content的控制器操作是否使用正确的 目前,我正在尝试做如下工作: response.should render_template(partial: "path/to/_template", locals: {local_array: []}) 这会导致rspec在assert_模板中爆炸。我更喜欢避免使用存根渲染方法 有人对如何实现这一点有什么好的想法吗 轨道3.1 RSpec 2.7检查局部变量时,RSpec代码中似乎存在错误,
response.should render_template(partial: "path/to/_template", locals: {local_array: []})
这会导致rspec在assert_模板中爆炸。我更喜欢避免使用存根渲染方法
有人对如何实现这一点有什么好的想法吗
轨道3.1
RSpec 2.7检查局部变量时,RSpec代码中似乎存在错误,您必须在部分名称中删除下划线 具体而言:
response.should render_template(partial: "path/to/template", locals: {local_array: []})
会起作用,但你的例子不会
编辑:
这个问题实际上存在于assert_模板中,因为render_模板委托给它。正在此处跟踪此问题: