mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #17995 from jethroo/fix/assert_template_with_unsupported_layout_type
assert template should raise ArgumentError for unsupported layout types
This commit is contained in:
commit
e745ae297f
2 changed files with 9 additions and 0 deletions
|
@ -145,6 +145,8 @@ module ActionController
|
||||||
assert(@_layouts.keys.any? {|l| l =~ expected_layout }, msg)
|
assert(@_layouts.keys.any? {|l| l =~ expected_layout }, msg)
|
||||||
when nil, false
|
when nil, false
|
||||||
assert(@_layouts.empty?, msg)
|
assert(@_layouts.empty?, msg)
|
||||||
|
else
|
||||||
|
raise ArgumentError, "assert_template only accepts a String, Symbol, Regexp, nil or false for :layout"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -575,6 +575,13 @@ class AssertTemplateTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
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
|
def test_passes_with_correct_layout
|
||||||
get :render_with_layout
|
get :render_with_layout
|
||||||
assert_template :layout => "layouts/standard"
|
assert_template :layout => "layouts/standard"
|
||||||
|
|
Loading…
Reference in a new issue