1
0
Fork 0
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:
Rafael Mendonça França 2014-12-16 18:35:38 -02:00
commit e745ae297f
2 changed files with 9 additions and 0 deletions

View file

@ -145,6 +145,8 @@ module ActionController
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

View file

@ -575,6 +575,13 @@ class AssertTemplateTest < ActionController::TestCase
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"