aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-04-01 00:50:09 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2008-04-01 00:50:09 +0000
commit9cc478a2547bec5b72fa2a4b36b2f8e627373a74 (patch)
tree5f23c1449d7701acdee3b3f411412634f042b691 /actionpack/test/controller
parent2681d55e407233c126ff8f0a5956c302b3acfb91 (diff)
downloadrails-9cc478a2547bec5b72fa2a4b36b2f8e627373a74.tar.gz
rails-9cc478a2547bec5b72fa2a4b36b2f8e627373a74.tar.bz2
rails-9cc478a2547bec5b72fa2a4b36b2f8e627373a74.zip
Support render :partial => collection of heterogeneous elements. Closes #11491.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9177 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/fake_models.rb6
-rw-r--r--actionpack/test/controller/new_render_test.rb20
2 files changed, 26 insertions, 0 deletions
diff --git a/actionpack/test/controller/fake_models.rb b/actionpack/test/controller/fake_models.rb
index 2761b09f2f..7420579ed8 100644
--- a/actionpack/test/controller/fake_models.rb
+++ b/actionpack/test/controller/fake_models.rb
@@ -3,3 +3,9 @@ class Customer < Struct.new(:name, :id)
id.to_s
end
end
+
+class BadCustomer < Customer
+end
+
+class GoodCustomer < Customer
+end
diff --git a/actionpack/test/controller/new_render_test.rb b/actionpack/test/controller/new_render_test.rb
index 0f14de54b1..342e2e7f87 100644
--- a/actionpack/test/controller/new_render_test.rb
+++ b/actionpack/test/controller/new_render_test.rb
@@ -163,6 +163,21 @@ class NewRenderTestController < ActionController::Base
render :partial => [ Customer.new("david"), Customer.new("mary") ], :locals => { :greeting => "Bonjour" }
end
+ def partial_collection_shorthand_with_different_types_of_records
+ render :partial => [
+ BadCustomer.new("mark"),
+ GoodCustomer.new("craig"),
+ BadCustomer.new("john"),
+ GoodCustomer.new("zach"),
+ GoodCustomer.new("brandon"),
+ BadCustomer.new("dan") ],
+ :locals => { :greeting => "Bonjour" }
+ end
+
+ def partial_collection_shorthand_with_different_types_of_records_with_counter
+ partial_collection_shorthand_with_different_types_of_records
+ end
+
def empty_partial_collection
render :partial => "customer", :collection => []
end
@@ -741,6 +756,11 @@ EOS
assert_equal "Bonjour: davidBonjour: mary", @response.body
end
+ def test_partial_collection_shorthand_with_different_types_of_records
+ get :partial_collection_shorthand_with_different_types_of_records
+ assert_equal "Bonjour bad customer: mark1Bonjour good customer: craig2Bonjour bad customer: john3Bonjour good customer: zach4Bonjour good customer: brandon5Bonjour bad customer: dan6", @response.body
+ end
+
def test_empty_partial_collection
get :empty_partial_collection
assert_equal " ", @response.body