aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorLucas Mazza <luc4smazza@gmail.com>2011-12-21 17:31:53 -0200
committerLucas Mazza <luc4smazza@gmail.com>2011-12-21 17:34:21 -0200
commit9fbaf9f0777485b32ae12d0cc261695b9bb26eea (patch)
treeb28b01af3b789b5d20658c019dc085d5dd301fad /actionpack/test
parenta03d26e1892d5b9363b1ea8b6f9ff2aa829d0f37 (diff)
downloadrails-9fbaf9f0777485b32ae12d0cc261695b9bb26eea.tar.gz
rails-9fbaf9f0777485b32ae12d0cc261695b9bb26eea.tar.bz2
rails-9fbaf9f0777485b32ae12d0cc261695b9bb26eea.zip
raises an ArgumentError if no valid options are given to TemplateRenderer#determine_template
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/template/render_test.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb
index 2ba86306f4..761bcf61f2 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