diff options
author | Lucas Mazza <luc4smazza@gmail.com> | 2011-12-21 17:31:53 -0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-12-21 21:17:17 +0100 |
commit | b5bb3f85585402dc9bedb93e98c13587657eabd4 (patch) | |
tree | 045fb5443ff106f62df0df5083e9f62b3a86467b /actionpack/test/template | |
parent | 2d07c60b684a7082fa5dc052c9f965adcda1cb75 (diff) | |
download | rails-b5bb3f85585402dc9bedb93e98c13587657eabd4.tar.gz rails-b5bb3f85585402dc9bedb93e98c13587657eabd4.tar.bz2 rails-b5bb3f85585402dc9bedb93e98c13587657eabd4.zip |
raises an ArgumentError if no valid options are given to TemplateRenderer#determine_template
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/render_test.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb index c29519276d..b1a866b148 100644 --- a/actionpack/test/template/render_test.rb +++ b/actionpack/test/template/render_test.rb @@ -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 @@ -43,21 +50,21 @@ module RenderTestCases assert_match "<h1>No Comment</h1>", @view.render(:template => "comments/empty", :formats => [:html]) assert_match "<error>No Comment</error>", @view.render(:template => "comments/empty", :formats => [:xml]) end - + def test_render_file_with_locale assert_equal "<h1>Kein Kommentar</h1>", @view.render(:file => "comments/empty", :locale => [:de]) assert_equal "<h1>Kein Kommentar</h1>", @view.render(:file => "comments/empty", :locale => :de) end - + def test_render_template_with_locale assert_equal "<h1>Kein Kommentar</h1>", @view.render(:template => "comments/empty", :locale => [:de]) end - + def test_render_file_with_handlers assert_equal "<h1>No Comment</h1>\n", @view.render(:file => "comments/empty", :handlers => [:builder]) assert_equal "<h1>No Comment</h1>\n", @view.render(:file => "comments/empty", :handlers => :builder) end - + def test_render_template_with_handlers assert_equal "<h1>No Comment</h1>\n", @view.render(:template => "comments/empty", :handlers => [:builder]) end |