Skip to content
This repository
Browse code

Added two failing tests for partials with locals from controller

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1937 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit e95dd53a5d909338a8cf7720989d16b2620f78e2 1 parent d876daf
David Heinemeier Hansson dhh authored
27 actionpack/test/controller/new_render_test.rb
@@ -81,6 +81,18 @@ def partial_only
81 81 def partial_only_with_layout
82 82 render :partial => "partial_only", :layout => true
83 83 end
  84 +
  85 + def partial_with_locals
  86 + render :partial => "customer", :locals => { :customer => Customer.new("david") }
  87 + end
  88 +
  89 + def partial_collection
  90 + render :partial => "customer", :collection => [ Customer.new("david"), Customer.new("mary") ]
  91 + end
  92 +
  93 + def partial_collection_with_locals
  94 + render :partial => "customer", :collection => [ Customer.new("david"), Customer.new("mary") ], :locals => { :extra => ", fun!" }
  95 + end
84 96
85 97 def hello_in_a_string
86 98 @customers = [ Customer.new("david"), Customer.new("mary") ]
@@ -315,4 +327,19 @@ def test_partials_list
315 327 get :partials_list
316 328 assert_equal "goodbyeHello: davidHello: marygoodbye\n", @response.body
317 329 end
  330 +
  331 + def test_partial_with_locals
  332 + get :partial_with_locals
  333 + assert_equal "Hello: David", @response.body
  334 + end
  335 +
  336 + def test_partial_collection
  337 + get :partial_collection
  338 + assert_equal "Hello: davidHello: mary", @response.body
  339 + end
  340 +
  341 + def test_partial_collection_with_locals
  342 + get :partial_collection_with_locals
  343 + assert_equal "Hello: david, fun!Hello: mary, fun!", @response.body
  344 + end
318 345 end
2  actionpack/test/fixtures/test/_customer.rhtml
... ... @@ -1 +1 @@
1   -Hello: <%= customer.name %>
  1 +Hello: <%= customer.name %><%= extra %>

0 comments on commit e95dd53

Please sign in to comment.
Something went wrong with that request. Please try again.