提交 7ff31feb 编写于 作者: C Carsten Wirth

adding that assert_template with :layout will raise ArgumentError for unknown layout type

上级 81e940c3
......@@ -145,6 +145,8 @@ def assert_template(options = {}, message = nil)
assert(@_layouts.keys.any? {|l| l =~ expected_layout }, msg)
when nil, false
assert(@_layouts.empty?, msg)
else
raise ArgumentError, "assert_template only accepts a String, Symbol, Regexp, nil or false for :layout"
end
end
......
......@@ -575,6 +575,13 @@ def test_fails_expecting_no_layout
end
end
def test_fails_expecting_not_known_layout
get :render_with_layout
assert_raise(ArgumentError) do
assert_template :layout => 1
end
end
def test_passes_with_correct_layout
get :render_with_layout
assert_template :layout => "layouts/standard"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册