隔离模式和渲染下的控制器规格:更新
我正在使用 RSpec 来编写我的控制器测试/规格。
我遇到的问题是呈现以下代码:
render :update do |page|
page['middle_content'].replace_html :partial => "admin/pages/show"
end
隔离模式是默认模式,不是吗?
我该如何解决这个问题或者我做错了什么?
例如,这里是一个失败的控制器规范:
it "should be succesful" do
xhr :delete, :destroy, :page_id => 1, :id => 1
response.should be_success
end
错误消息:
should be succesful
Mock 'Page_1' received unexpected message :title with (no args)
On line #1 of app/views/admin/pages/_administration.html.erb
管理部分在显示部分中呈现
最好的问候
编辑:我已将此问题发布到 RSpec 的灯塔帐户。
I am using RSpec for writing my controller tests/specs.
I faced the problem, that the following code gets rendered:
render :update do |page|
page['middle_content'].replace_html :partial => "admin/pages/show"
end
Isolation mode is the default, isn't it?
How can I fix this or am I doing something wrong?
Here is for example a failing controller spec:
it "should be succesful" do
xhr :delete, :destroy, :page_id => 1, :id => 1
response.should be_success
end
The error message:
should be succesful
Mock 'Page_1' received unexpected message :title with (no args)
On line #1 of app/views/admin/pages/_administration.html.erb
The adminitration partial gets rendered in the show partial
Best regards
EDIT: I have posted this issue to the lighthouse account of RSpec.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许这会对你有帮助。如果我添加以下内容,
一切都会正常(视图不会被渲染)。
你们有人有想法吗?
Maybe this will help you. If I add the following
everything will work(the views won't get rendered).
Does anybody of you got an idea?