Skip to content
This repository
Browse code

Added tests for partial collection counters [#766 state:resolved]

Signed-off-by: Joshua Peek <josh@joshpeek.com>
  • Loading branch information...
commit 2faf35cea9846fdfa1099f5dfd1589d53a3daf3b 1 parent ea0d036
authored August 09, 2008 josh committed August 09, 2008
9  actionpack/test/controller/new_render_test.rb
@@ -136,6 +136,10 @@ def partial_only_with_layout
136 136
     render :partial => "partial_only", :layout => true
137 137
   end
138 138
 
  139
+  def partial_with_counter
  140
+    render :partial => "counter", :locals => { :counter_counter => 5 }
  141
+  end
  142
+
139 143
   def partial_with_locals
140 144
     render :partial => "customer", :locals => { :customer => Customer.new("david") }
141 145
   end
@@ -741,6 +745,11 @@ def test_action_talk_to_layout
741 745
     assert_equal "<title>Talking to the layout</title>\nAction was here!", @response.body
742 746
   end
743 747
 
  748
+  def test_partial_with_counter
  749
+    get :partial_with_counter
  750
+    assert_equal "5", @response.body
  751
+  end
  752
+
744 753
   def test_partials_list
745 754
     get :partials_list
746 755
     assert_equal "goodbyeHello: davidHello: marygoodbye\n", @response.body
1  actionpack/test/fixtures/test/_counter.html.erb
... ...
@@ -0,0 +1 @@
  1
+<%= counter_counter %>
12  actionpack/test/template/render_test.rb
@@ -47,6 +47,10 @@ def test_render_partial
47 47
     assert_equal "only partial", @view.render(:partial => "test/partial_only")
48 48
   end
49 49
 
  50
+  def test_render_partial_with_locals
  51
+    assert_equal "5", @view.render(:partial => "test/counter", :locals => { :counter_counter => 5 })
  52
+  end
  53
+
50 54
   def test_render_partial_with_errors
51 55
     assert_raise(ActionView::TemplateError) { @view.render(:partial => "test/raise") }
52 56
   end
@@ -54,14 +58,14 @@ def test_render_partial_with_errors
54 58
   def test_render_partial_collection
55 59
     assert_equal "Hello: davidHello: mary", @view.render(:partial => "test/customer", :collection => [ Customer.new("david"), Customer.new("mary") ])
56 60
   end
57  
-  
  61
+
58 62
   def test_render_partial_collection_as
59  
-    assert_equal "david david davidmary mary mary", 
  63
+    assert_equal "david david davidmary mary mary",
60 64
       @view.render(:partial => "test/customer_with_var", :collection => [ Customer.new("david"), Customer.new("mary") ], :as => :customer)
61 65
   end
62  
-  
  66
+
63 67
   def test_render_partial_collection_without_as
64  
-    assert_equal "local_inspector,local_inspector_counter,object", 
  68
+    assert_equal "local_inspector,local_inspector_counter,object",
65 69
       @view.render(:partial => "test/local_inspector", :collection => [ Customer.new("mary") ])
66 70
   end
67 71
 

0 notes on commit 2faf35c

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