1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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
This commit is contained in:
David Heinemeier Hansson 2005-07-27 09:11:00 +00:00
parent d876daf51f
commit e95dd53a5d
2 changed files with 28 additions and 1 deletions

View file

@ -82,6 +82,18 @@ class NewRenderTestController < ActionController::Base
render :partial => "partial_only", :layout => true
end
def partial_with_locals
render :partial => "customer", :locals => { :customer => Customer.new("david") }
end
def partial_collection
render :partial => "customer", :collection => [ Customer.new("david"), Customer.new("mary") ]
end
def partial_collection_with_locals
render :partial => "customer", :collection => [ Customer.new("david"), Customer.new("mary") ], :locals => { :extra => ", fun!" }
end
def hello_in_a_string
@customers = [ Customer.new("david"), Customer.new("mary") ]
render :text => "How's there? #{render_to_string("test/list")}"
@ -315,4 +327,19 @@ class NewRenderTest < Test::Unit::TestCase
get :partials_list
assert_equal "goodbyeHello: davidHello: marygoodbye\n", @response.body
end
def test_partial_with_locals
get :partial_with_locals
assert_equal "Hello: David", @response.body
end
def test_partial_collection
get :partial_collection
assert_equal "Hello: davidHello: mary", @response.body
end
def test_partial_collection_with_locals
get :partial_collection_with_locals
assert_equal "Hello: david, fun!Hello: mary, fun!", @response.body
end
end

View file

@ -1 +1 @@
Hello: <%= customer.name %>
Hello: <%= customer.name %><%= extra %>