aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/render_test.rb
diff options
context:
space:
mode:
authorkennyj <kennyj@gmail.com>2012-07-18 18:02:33 +0900
committerkennyj <kennyj@gmail.com>2012-08-03 02:05:47 +0900
commita8d68d89e32f58397378bc3a27cb1391c95ab328 (patch)
tree19eebf2abd84e2f2d24c7fe3c800b560499e8638 /actionpack/test/template/render_test.rb
parentb33e7ba140277ade581ed3506144111d29448c9f (diff)
downloadrails-a8d68d89e32f58397378bc3a27cb1391c95ab328.tar.gz
rails-a8d68d89e32f58397378bc3a27cb1391c95ab328.tar.bz2
rails-a8d68d89e32f58397378bc3a27cb1391c95ab328.zip
Improve error handling when using partial name with hyphen. Fix #7079
Diffstat (limited to 'actionpack/test/template/render_test.rb')
-rw-r--r--actionpack/test/template/render_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb
index 3ce1d20bd9..164b8b9fa1 100644
--- a/actionpack/test/template/render_test.rb
+++ b/actionpack/test/template/render_test.rb
@@ -187,6 +187,13 @@ module RenderTestCases
assert_equal "'#{nil.inspect}' is not an ActiveModel-compatible object. It must implement :to_partial_path.", e.message
end
+ def test_render_partial_with_hyphen
+ e = assert_raises(ArgumentError) { @view.render(:partial => "test/a-in") }
+ assert_equal "The partial name (test/a-in) is not a valid Ruby identifier; " +
+ "make sure your partial name starts with a lowercase letter or underscore, " +
+ "and is followed by any combination of letters, numbers and underscores.", e.message
+ end
+
def test_render_partial_with_errors
e = assert_raises(ActionView::Template::Error) { @view.render(:partial => "test/raise") }
assert_match %r!method.*doesnt_exist!, e.message