public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Added tests for partial collection counters [#766 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Cameron Yule (author)
Sat Aug 09 08:34:19 -0700 2008
josh (committer)
Sat Aug 09 08:48:56 -0700 2008
commit  2faf35cea9846fdfa1099f5dfd1589d53a3daf3b
tree    0f43c32ce041e6af277fe57e02264db6cd81a327
parent  ea0d036e31d984888303a79533ff872b787871ae
...
136
137
138
 
 
 
 
139
140
141
...
741
742
743
 
 
 
 
 
744
745
746
...
136
137
138
139
140
141
142
143
144
145
...
745
746
747
748
749
750
751
752
753
754
755
0
@@ -136,6 +136,10 @@ class NewRenderTestController < ActionController::Base
0
     render :partial => "partial_only", :layout => true
0
   end
0
 
0
+  def partial_with_counter
0
+    render :partial => "counter", :locals => { :counter_counter => 5 }
0
+  end
0
+
0
   def partial_with_locals
0
     render :partial => "customer", :locals => { :customer => Customer.new("david") }
0
   end
0
@@ -741,6 +745,11 @@ EOS
0
     assert_equal "<title>Talking to the layout</title>\nAction was here!", @response.body
0
   end
0
 
0
+  def test_partial_with_counter
0
+    get :partial_with_counter
0
+    assert_equal "5", @response.body
0
+  end
0
+
0
   def test_partials_list
0
     get :partials_list
0
     assert_equal "goodbyeHello: davidHello: marygoodbye\n", @response.body
...
47
48
49
 
 
 
 
50
51
52
...
54
55
56
57
 
58
59
 
60
61
62
 
63
64
 
65
66
67
...
47
48
49
50
51
52
53
54
55
56
...
58
59
60
 
61
62
 
63
64
65
 
66
67
 
68
69
70
71
0
@@ -47,6 +47,10 @@ class ViewRenderTest < Test::Unit::TestCase
0
     assert_equal "only partial", @view.render(:partial => "test/partial_only")
0
   end
0
 
0
+  def test_render_partial_with_locals
0
+    assert_equal "5", @view.render(:partial => "test/counter", :locals => { :counter_counter => 5 })
0
+  end
0
+
0
   def test_render_partial_with_errors
0
     assert_raise(ActionView::TemplateError) { @view.render(:partial => "test/raise") }
0
   end
0
@@ -54,14 +58,14 @@ class ViewRenderTest < Test::Unit::TestCase
0
   def test_render_partial_collection
0
     assert_equal "Hello: davidHello: mary", @view.render(:partial => "test/customer", :collection => [ Customer.new("david"), Customer.new("mary") ])
0
   end
0
-  
0
+
0
   def test_render_partial_collection_as
0
-    assert_equal "david david davidmary mary mary", 
0
+    assert_equal "david david davidmary mary mary",
0
       @view.render(:partial => "test/customer_with_var", :collection => [ Customer.new("david"), Customer.new("mary") ], :as => :customer)
0
   end
0
-  
0
+
0
   def test_render_partial_collection_without_as
0
-    assert_equal "local_inspector,local_inspector_counter,object", 
0
+    assert_equal "local_inspector,local_inspector_counter,object",
0
       @view.render(:partial => "test/local_inspector", :collection => [ Customer.new("mary") ])
0
   end
0
 

Comments