mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
raises an ArgumentError if no valid options are given to TemplateRenderer#determine_template
This commit is contained in:
parent
a03d26e189
commit
9fbaf9f077
2 changed files with 13 additions and 4 deletions
|
@ -25,6 +25,8 @@ module ActionView
|
|||
elsif options.key?(:template)
|
||||
options[:template].respond_to?(:render) ?
|
||||
options[:template] : find_template(options[:template], options[:prefixes], false, keys, @details)
|
||||
else
|
||||
raise ArgumentError, "You invoked render but did not give any of :partial, :template, :inline, :file or :text option."
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -20,6 +20,13 @@ module RenderTestCases
|
|||
assert_equal ORIGINAL_LOCALES, I18n.available_locales.map {|l| l.to_s }.sort
|
||||
end
|
||||
|
||||
def test_render_without_options
|
||||
@view.render()
|
||||
flunk "Render did not raise ArgumentError"
|
||||
rescue ArgumentError => e
|
||||
assert_match "You invoked render but did not give any of :partial, :template, :inline, :file or :text option.", e.message
|
||||
end
|
||||
|
||||
def test_render_file
|
||||
assert_equal "Hello world!", @view.render(:file => "test/hello_world")
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue