test_case.rb中的assert_template似乎已被破坏。如何在控制器规范中测试布局?

时间:2012-01-30 00:50:16

标签: ruby-on-rails testing rspec controller

下面是一段代码片段#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'

0 个答案:

没有答案