test_case.rb 中的assert_template 似乎已损坏。如何测试控制器规范中的布局?
下面是#assert_template 形式的代码片段。 Expected_layout 未定义!以及什么设置@layouts。
msg = build_message(message,
"expecting layout <?> but action rendered <?>",
expected_layout, @layouts.keys)
case layout = options[:layout]
when String
assert(@layouts.include?(expected_layout), msg)
我正在尝试断言在控制器操作中动态定义的布局。规范说......
response.should render_template(:layout => "bare", :partial => "show")
我明白了
NameError: undefined local variable or method `expected_layout'
Below is a code snippet form #assert_template. expected_layout is not defined! and what sets @layouts.
msg = build_message(message,
"expecting layout <?> but action rendered <?>",
expected_layout, @layouts.keys)
case layout = options[:layout]
when String
assert(@layouts.include?(expected_layout), msg)
I am trying assert the layout which is dynamically defined in the controller action. The spec says...
response.should render_template(:layout => "bare", :partial => "show")
I get
NameError: undefined local variable or method `expected_layout'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论