diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-01-12 06:10:06 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-01-12 06:10:06 +0000 |
commit | 89b472aa0cba44aa908348769abcde74025f6ec4 (patch) | |
tree | 160f2b26c0d07a9981eb0b2072665fbcf5c874ff /actionpack/test | |
parent | 9073cef8669b9f43dbeb83e306be3445d62566f8 (diff) | |
download | rails-89b472aa0cba44aa908348769abcde74025f6ec4.tar.gz rails-89b472aa0cba44aa908348769abcde74025f6ec4.tar.bz2 rails-89b472aa0cba44aa908348769abcde74025f6ec4.zip |
Test proving render_to_string result passed to partial works. Closes #2541. [smeade]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5893 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/new_render_test.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/actionpack/test/controller/new_render_test.rb b/actionpack/test/controller/new_render_test.rb index 6e1ec3417a..9b328e2c0a 100644 --- a/actionpack/test/controller/new_render_test.rb +++ b/actionpack/test/controller/new_render_test.rb @@ -167,6 +167,12 @@ class NewRenderTestController < ActionController::Base @after = "i'm after the render" render :action => "test/hello_world" end + + def render_to_string_with_partial + @partial_only = render_to_string :partial => "partial_only" + @partial_with_locals = render_to_string :partial => "customer", :locals => { :customer => Customer.new("david") } + render :action => "test/hello_world" + end def render_to_string_with_exception render_to_string :file => "exception that will not be caught - this will certainly not work", :use_full_path => true @@ -555,7 +561,13 @@ EOS assert_equal "i'm before the render", assigns(:before) assert_equal "i'm after the render", assigns(:after) end - + + def test_render_to_string_partial + get :render_to_string_with_partial + assert_equal "only partial", assigns(:partial_only) + assert_equal "Hello: david", assigns(:partial_with_locals) + end + def test_bad_render_to_string_still_throws_exception assert_raises(ActionController::MissingTemplate) { get :render_to_string_with_exception } end |